programming-examples/c/_Basic/To swap the address of two variables using pointer.c

20 lines
408 B
C
Raw Normal View History

2019-11-15 12:59:38 +01:00
#include <stdio.h>
#include <conio.h>
void swap(int *,int *);
void main()
{
int a=10,b=20;
clrscr();
printf("\nVALUES OF a AND b BEFORE SWAPING ARE %d %d",a,b);
swap(&a,&b);
printf("\nVALUES OF a AND b AFTER SWAPING ARE %d %d",a,b);
getch();
}
void swap(x,y)
int *x,*y;
{
int t;
t=*x;
*x=*y;
*y=t;
}