Pages

Saturday, March 6, 2010

Everyone of you must have studied "call by reference" when studing the basics of "c" language ... but today i am going to delve into a more deeper concept of "return by reference"!!!
defn:::
a function that returns a reference variable is actually an alias for the referred variable . this method of returning references is used in "operator overloading" to form a cascade of memeber function calls specified in a single statement..!!!
#include"library files"
int &max(int &x,int&y);
void main()
{
int a,b,c;
scanf("%d",%d",&a,&b);
printf("\n a= %d",a,"b=%d",b);
getch();
}
int &max(int &x,int &y)
{
if(x>y)
return x;
else return y;
}

No comments:

Post a Comment