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
A: Use operator overloading to present a friend right-shift operator, operator>>. It is similar to the output operator, except the parameter doesn't contain a const: "Fred&" instea

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. The area under a curve between two points can b

superposition of two waves

Define the Relational Operator in c language? The Relational operators refer to the relationships that values can have with one another and they are used to compare two operand

C++ Programming Assignment ATM Machine Phase 1 In this assignment you will create a program that allows a user to do the following: 1) Create a bank account by supplying a use

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

what is the difference between call by reference and call by pointer method?

Binary logical bit-wise operators  There are three logical bit-wise operators :                   &             and                 |              or

Structure of C++ Program: Chronological order of C++ program. 1.   Class declaration 2.   Main function program 3.   Member functions definitions 4.   Include heade