Program for swapping through function and pointer
#include<iostream.h>
#include<conio.h>
int swap(int *,int *);
void main()
{
clrscr();
int x=10,y=20;
swap(&x,&y);
cout<<"X = "<<x<<endl;
cout<<"Y = "<<y;
getch();
}
int swap(int *p, int *q)
{
int temp;
temp=*p;
*p=*q;
*q=temp;
return (*p,*q);
}