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
S y m b o li c c o n s t a n t : c on s t m a x = 1 0 0 ; T h e d e f a u l t d a t a t y p e w i l l b e i n t e

I need help with virtual memory manager implementation in C

#question.conversion of tree into binary tree.

You are required to write a stand-alone DSP application in the C programming language. The overall objective of this application is to convert a signal from the time domain to t


Explain protected, public, private in C++? These are three access spaecifiers in C++. - Public - Here data members and functions are accessible outside the class. - Pr

A: this is a procedure during exception handling while the destructor is called for all local objects in the stack among the place where the exception was thrown & where this is ca

what is the purpose of pointer ? what is the syntax? how it works?

What is the difference among const char *myPointer and char *const myPointer?  A: Const char *myPointer is a non constant pointer to constant data; whereas char *const myPointer

I need Computer application/program. Project Description:                                                                I want a project done. It is a computer desktop appli