Explain Call by Value and Call by Reference through stack in data structure ?
Call by Value and Call by Reference
147417-Jul-2018
Updated on 17-Jul-2018
Home / DeveloperSection / Forums / Call by Value and Call by Reference
Explain Call by Value and Call by Reference through stack in data structure ?
Prakash nidhi Verma
17-Jul-2018Call by value:
the called function creates a new set of variables in stack is called call by value whch is copies the values of the arguments into method.
- push value of b
- push value of a
- save return address
- call function
Call by reference:
instead of passing values to the function by a pointers to the original variables are passed this method known as call by reference method.
- push address of b
- push address of a
- save return address
- call function