What is passing by reference?

chinmay.sahoo

New member
Method of passing arguments to a function which takes parameter of type reference. for example: void swap( int & x, int & y ) { int temp = x; x = y; y = temp; } int a=2, b=3; swap( a, b ); Basically, inside the function there won't be any copy of the arguments "x" and "y" instead they refer to original variables a and b. so no extra memory needed to pass arguments and it is more efficient.
 
The call by referrals method of moving justifications to the purpose duplicates the referrals of an discussion into the official parameter.
 
Back
Top