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
Objective: Construct a C program that controls the UART, and is capable of displaying strings. Echo characters received on the UART to the LCD screen Outcome: A mess

Is it probable to encompass Virtual Constructor? If yes, how? If not, Why?

in this problem u given a board in which some of the elements are placed as shown in diagram below .each element represent a color .fill the other elements in the board such that n

Readers Writers with Processes and Threads Write two programs implementing ``reader pritority readers-writers synchronization'''' on files. One program will use processes, created

A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome

c program for boardcolouring

Operation on array: void Array::add( Object& toAdd ) {     lastElementIndex++;     while( ptrAt( lastElementIndex ) != ZERO &&            lastElementIndex

#Smugglers are becoming very smart day by day. Now they have developed a new technique of sending their messages from one smuggler to another. In their new techn

There is a pebble merchant. He sells the pebbles, that are used for shining the floor. His main duty is to take the length of the room’s sides. But he sometimes mistakes doing that

Program to store family members details in C++: #include #include #include struct record {   char name[30];   int age;   char state[40]; }x; //cal