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
how to make the coding

Given an integer n and a permutation of numbers 1, 2 ... , n-1, n write a program to print the permutation that lexicographically precedes the given input permutation. If the given

Hi I''m trying to connect to CISCO router using termios. So I decided to have two threads one for reading data and the other one for writing data. The problem is that I have to add


Need help finishing my homework. It''s been 5 years since I''ve use C++. I am a VN.Net programmer. -Todd


How does an ERP System facilitates better decision making?

I need to implement a mini version of linux''s ''tar'' function in C.

how to use a pointer variable?

To implement a back account system for new users