Difference Between call by value and call by reference
Call By Value
|
Call By Reference
|
Call by value return the value to the main function
|
Call by reference return the address to the main function.
|
Change in the sub function does not reflect to the
main function
|
Change in the sub function reflects to the main function.
|
It can return only one value of variable.
|
It can return more than one value of variables because it return reference
|
In Function call value is passed.
|
In Function call address is passed.
|
C and Java restrict themselves to Call by Value.
|
C++ and Pascal let you declare that a parameter is a
reference.
|
Value of actual parameter is used to initialize the
formal parameter.
|
Formal parameter refers to the same memory cell for
the actual parameter.
|
0 comments:
Post a Comment