Swapping of two number using pointer in C

#include<stdio.h>
#include<conio.h>
void main ()
{
int a=5,b=7,t;
int *p1=&a,*p2=&b;
clrscr();
printf(“%d,%d\n”,a,b);
t=*p1;
*p1=*p2;
*p2=t;
printf(“%d,%d”,a,b);
getch();
}

After Running Program 🙂

Leave a Reply