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
C Program for REVERSE THE STRING #include stdio.h> #include conio.h> #include string.h> void main() {           char name[30];           char *s;

Produce data from fixed OCR areas scanned. Project Description: Project is to design software which can use character recognition only on certain areas of scanned puff's/ jpe


In this sub-task will you implement three functions for the final three function prototypes that will do exactly the same as the three functions that you have just written. This ti

WAP TO PRINT THE LARGEST NUMBER FROM ANY 10 NUMBERS #include stdio.h> #include conio.h>   void main()   {                    int a[10],i,max;

C Program to FIND THE EVEN WORDS IN THE STRING #include conio.h> #include stdio.h> void main() {           char a[50],temp;           int i=0,k=0,l[25],c=0,r=0;

Write a program that finds the minimum total number of shelv, C/C++ Programming


how to see inbox details of a particular email adress on console

Step 1 Define the program headers and the variables      #include   #include   #include   #include void main()   {       char prompt;     float a,b,c,d,e;     floa