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
Write a C program "team.c" that maintains information for a soccer team. The program will allow you to add and delete players from your team, to search your team for players by nam


An employee’s total weekly pay equals the hourly wage multiplied by the total number of regular hours plus any overtime pay. Overtime pay equals the total overtime hours multiplied

overloadstream insertion opertator to display the data of object on the console

Question : (a) (i) What is a structure member in C? What is the relationship between a structure member and the structure? (ii) How can structure variables be declared in C?

Question 1 Write a program that accepts two numbers from the user and swaps the two numbers without using a temporary variable Question 2 Write a program that accepts a 3x


C program to define power of a function: Write a program to use power of a function. void main() { int x,y,po=1,i,j; clrscr();   printf("Give x,y\n"); sca

Op e r a t o r P r e c e d e n c e a n d A s s o c i a t i v e l y : T h e op e r a t o r p r e c e d e n c e a n d i

Write a program that keeps record of football results. Program stores following information about each match: Description Type and/or size name of home team max. 25 characters name