There is no additional memory set aside for the corresponding variable in the function. The variable in the calling function and the corresponding variable in the called function share the same address. Since they both refer to the same location in memory, anything that is done to the variable in the called function is also done to the variable in the calling function. In the program below, variable a is passed by value. Variable b is passed by reference with references.
Variable c is passed by reference with pointers.
A separate memory location is set aside for z and it holds the address of c . Since z points to c , when z is dereferenced, c is affected. Program demonstrating different methods of passing arguments to functions. Print the values and address of a, b, and c after the function call.