#include<iostream.h>
#include<conio.h>
void cba(int *a,int *b)
{
                int *c;
                *c=*a;
                *a=*b;
                *b=*c;
                cout<<"\tFunction Call \n";
                cout<<"A = "<<*a<<"\tB = "<<*b<<endl;
                cout<<"Address of A = "<<(unsigned)&a<<endl;
                cout<<"Address of B = "<<(unsigned)&b<<endl;
}
void main()
{
                int x,y;
                clrscr();
                cout<<"Enter Two Value : \n";
                cin>>x>>y;
                cout<<"\tBefore Function Call \n";
                cout<<"X = "<<x<<"\tY = "<<y<<endl;
                cout<<"Address of X = "<<(unsigned)&x<<endl;
                cout<<"Address of Y = "<<(unsigned)&y<<endl;
                cba(&x,&y);
                cout<<"\tAfter Function Call In main() \n";
                cout<<"X = "<<x<<"\tY = "<<y<<endl;
                cout<<"Address of X = "<<(unsigned)&x<<endl;
                cout<<"Address of Y = "<<(unsigned)&y<<endl;
                getch();
}

70.PNG

Advertisements