Image

Programs - C++ - General

Program:

#include
#include
void swap(int *x,int *y);
void main()
{
int x,y;
x=10;
y=20;
printf("\n x = %d y = %d",x,y);
swap(&x,&y);printf("\n x = %d y= %d",x,y);
getch();
clrscr();
}
void swap(int *a, int *b)
{
int temp;
temp=*a;
*a=*b;
*b=temp;
}