Learnings of the Week [November 24-28, 2008]
In this week, we continued discussing about functions. But Sir Balbuena met us only once because our school held the Regional Press Conference.
Pass by Value
The actual parameter is fully evaluated and the resulting value is copied into a location being used to hold the formal parameter's value during method/function execution. That location is typically a chunk of memory on the runtime stack for the application (which is how Java handles it), but other languages could choose parameter storage differently.
Pass by Reference
The formal parameter merely acts as an alias for the actual parameter. Anytime the method/function uses the formal parameter (for reading or writing), it is actually using the actual parameter.
Call by Value
In the method call by value, the values of the actual parameters are passed to the formal parameters. Changes that happen to the values of the formal parameters inside the function will not affect the values of the actual parameters.
Pass by Value
The actual parameter is fully evaluated and the resulting value is copied into a location being used to hold the formal parameter's value during method/function execution. That location is typically a chunk of memory on the runtime stack for the application (which is how Java handles it), but other languages could choose parameter storage differently.
Pass by Reference
The formal parameter merely acts as an alias for the actual parameter. Anytime the method/function uses the formal parameter (for reading or writing), it is actually using the actual parameter.
Call by Value
In the method call by value, the values of the actual parameters are passed to the formal parameters. Changes that happen to the values of the formal parameters inside the function will not affect the values of the actual parameters.
ACTUAL AND FORMAL PARAMETERS
Actual Parameters are the variables found in the function call whose values will be passed to the formal parameters of the called function.
Formal Parameters are the variables found in the function header that will receive from the actual parameters.
Posted by:
RAE ANGELINE S. PALEN
IV - Rizal
Scope of variables
The scope of variables declared within a function or any other inner block is only their own function or their own block and cannot be used outside of them.Posted by:
RAE ANGELINE S. PALEN
IV - Rizal


0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home