Wednesday, 18 January 2012

Program Of Call By Address In C++


#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 NAswer="<<c;
getch();
}
int sum(int *x,int *y)    // Function Define
{
int  z;
z= *x + * y;
return z;
}

-------------------------------------------------------------------------------


In call by address, instead of passing the actual values of the actual argument we pass addresses of actual values. Whenever we deal with addresses, we must know how to handle them. That’s why before discussing call by address, we will briefly discuss pointers that handle addresses.

No comments:

Post a Comment