C Program to swap two numbers using pointer .


#include<stdio.h>
#include<conio.h>

void swap(int *x,int *y)
{
   int temp;
   temp=*x;
   *x=*y;
   *y=temp;
}

void main()
{
   int n1,n2;
   clrscr();
   printf("\n\tEnter Details\n\n Number 1\t: ");
   scanf("%d",&n1);
   printf("\n Number 2\t: ");
   scanf("%d",&n2);
   swap(&n1,&n2);
   printf("\n\t Swap successfully\n\n Number 1\t: %d\n\n Number 2\t: %d",n1,n2);
   getch();
}