PROGRAM TO PERFORM RRETURN BY REFERENCE


Program to perform return by reference:

Code:

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int &max(int &,int &);
int a,b;
cin>>a>>b;
max(a,b)=-1;
cout<<a<<"\t"<<b;
}
int &max(int &x,int &y)
{
if(x>y)
return x;
else
return y;
}

Output:
3 4
3     -1

Comments

Popular posts from this blog

PROGRAM TO PERFORM CALL BY REFERENCE