/* This is a example of return by reference */
int &smallo(int a, int b)
{
if(a>b)
return a;
else
return b;
}
void main()
{
int a, b;
cout<< "\n Enter two numbers :";
cin >> a >> b;
cout<< "\n The original values :" << a << " and " << b;
smallo(a, b) = 0;
cout<< "\n The changed values :" << a << " and " << b;
getch();
}
#include <iostream.h>
#include <conio.h>
int &smallo(int a, int b)
{
if(a>b)
return a;
else
return b;
}
void main()
{
int a, b;
cout<< "\n Enter two numbers :";
cin >> a >> b;
cout<< "\n The original values :" << a << " and " << b;
smallo(a, b) = 0;
cout<< "\n The changed values :" << a << " and " << b;
getch();
}
yahan per choro main int ke bad & aur neche void main ke under smallo(a,b) = 0 kyun hai
ReplyDelete