#include <stdio.h>
void swap();
void main()
{
int i, j;
printf("\n Swapping Program using Pointer");
printf("\n Enter the Two Values i and j:");
scanf("%d %d",&i,&j);
printf("\n Before Swapping the values i=%d j=%d",i ,j);
swap(&i,&j);
printf("\n After Swapping the Values i=%d j=%d",i,j);
}
void swap (int *p1, int *p2)
{
int t;
t=*p1;
*p1=*p2;
*p2=t;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: