Return by reference, C/C++ Programming

Return by reference:

The return value of the function must be an address variable.  In following program the

function returns the value of x or y and their types are declared as reference variable.

 

int &f_ref(int &c, int &d); // int &f_ref(int, int) is invalid for reference variable void main( )

{int a, b,c;

c=f_ref(a, b);

}

int &f_ref(int &x, int &y)

{if x>y return x; else return y;

}

 

 

Posted Date: 9/20/2012 7:46:02 AM | Location : United States







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

Write discussion on Return by reference
Your posts are moderated
Related Questions
.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.

Define the Meaning of Call by reference? In "call-by- reference", as an alternative of passing the value of a variable, the location number (or the address) of the variable is


Write a C program to input five numbers and print them out on a new line e.g 5, 10, 15, 20, 25 displayed as   5   10   15   20   25 #include stdio.h   void main()   {

write a C rpogram that can display the transpose form of a ciphertext matrix.Prompt users to provide row and coloumn number of matrix.Then user will input plaintext and the program

Define Internal static storage class - computer programming? The Internal static variables are those that declared inside a function. The scope of the internal static variables

Hiding overloaded functions We cannot overload a base class function by redefining it in a derived class with a dissimilar argument list. Consider examples to see if similar fu

How to Create A Data File? A data file should be created before it can be processed. A stream-oriented data file is able to be created in two ways. One is to create the file st

for different operation multiple stack

program to find if a no . is prime or not