Define passing by reference?, C/C++ Programming

A: Method of passing arguments to a function that takes parameter of type reference.

 for instance:

void swap( int & x, int & y )

{

int temp = x;

x = y;

y = temp;

}

int a=2, b=3;

swap( a, b );

Essentially, inside the function there won't be any copy of arguments "y" and "x" instead they refer to original variables a & b. thus no extra memory required to pass arguments and it is more efficient.

 

Posted Date: 3/21/2013 7:27:11 AM | Location : United States







Related Discussions:- Define passing by reference?, Assignment Help, Ask Question on Define passing by reference?, Get Answer, Expert's Help, Define passing by reference? Discussions

Write discussion on Define passing by reference?
Your posts are moderated
Related Questions

Where are longjmp and setjmp used in C++? -Setjmp and longjmp must not be used in C++. - Longjmp jumps out of the function without unwinding stack. This means that local obj

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b

write aprogram in c++ to overload +,-,=,++ operator using unary and friend function in a single program


Define the Assignment Operators in c language? The assignment operators can be used to assign a value to the variable and is represented by equal to (=) sign. The Assignment ex

how do i write a c++ program that will input a number and output its factorial using the while loop

Question 1 Describe the following with respect to pointers in C language- Pointers and Arrays Usage of Pointers in functions Write programs in C to demonstrate the

Prepare an Application in C# or C++ Project Description: We are seeking someone who can write a program in C# or C++. The idea is to prepare the program using a Cross Plat