0 votes
84 views
asked by (3.1k points)
What is the difference between call by value and call by reference in a user defined function in C++?

1 Answer

0 votes
answered by (2.3k points)

      The value of the actual parameters in the calling function do not get affected when the arguments are passed using call by value method, since actual and formal parameters have different memory locations.
      The values of the formal parameters affect the values of actual parameters in the calling function, when the arguments are passed using call by reference method. This happens since the formal parameters are not allocated any memory, but they refer to the memory locations of their corresponding actual parameters.

Categories

...