C program to swap two numbers using pointers

C program to swap two numbers using pointers

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

void main()
{
int *a,*b,*temp;
clrscr();
printf(“Enter two mumbers:”);
scanf(“%d%d”,a,b);
printf(“Before Swaping:na=%d b=%d”,*a,*b);

temp=a;
a=b;
b=temp;

printf(“nAfter Swaping:na=%d b=%d”,*a,*b);
getch();
}

2 thoughts on “C program to swap two numbers using pointers”

Leave a Comment

Your email address will not be published. Required fields are marked *