#include<iostream.h>
#include<conio.h>
int sum(int &x,int &y); // Function Delaration
main()
{
clrscr();
int a,b,c;
cout<<"Enter First NUmber=";
cin>>a;
cout<<"Enter Second NUmber=";
cin>>b;
c=sum(a,b); // Function CAlling
cout<<"\n Address of a"<<&a;
cout<<"\n NAswer="<<c;
getch();
}
int sum(int &x,int &y) // Function Define
{
int z;
cout<<"\n Address &x"<<&x;
z= x + y;
return z;
}
-----------------------------------------------------------------------------------
In call by reference, a function passes a reference as an argument to another function. In this case the called function works on the callers copy of parameters and not on a local copy. Before the discussion of call by reference we must know what is a reference.
No comments:
Post a Comment