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
What are Arrays? Numerous applications require the processing of multiple data items that have identical characteristics. In such circumstances it is frequently convenient to p

explain Storage management: free storage pool, garbage collection, compaction, boundary tag method; Hash tables and hashing functions

Explain about the Integer constants in c language? An integer constant is the integer valued number and it refers to a sequence of digits. A decimal integer constant includes o

C Program for MULTIPLICATION TABLE   main() {           int a, b=1, c, d;           char ch;           clrscr();           while(ch!='n')           {

within 2 mins give me answer pllzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz

Question: (a) A bank has four types of accounts with annual interest rates as follows: Savings 8% Savings with Cheque Book 5% Current 4% Fixed deposits 10% Using

Function Templates Function templates give you with the capability to write a one function that is a skeleton, or template, for a family of similar functions. In function ov

Need Cron Job Parsing JSON from API, Inserting in to DB Project Description: The Project is to prepare a Cron Job with an adjustable interval in seconds and milli seconds. Cr

Explain one-definition rule (ODR). According to one-definition rule, C++ constructs should be identically defined in each compilation unit they are used in. As per ODR, two