//Program to swap two no.s using call by ponter and call by reference

| |


 #include<iostream.h>
#include<conio.h>
void swap(int*,int*);
void main()
{
clrscr();
int a,b;
cout<<"enter a:";
cin>>a;
cout<<"\n enter b:";
cin>>b;
swap(&a,&b);
cout<<"\n using call by pointer"<<endl;
cout<<"\n after swaping:"<<"\n a="<<a<<" b="<<b;
getch();
}
void swap(int*a_p,int*b_p)
{
int temp;
temp=*a_p;
*a_p=*b_p;
*b_p=temp;
}


<