#include<stdio.h>
#include<conio.h>
void swape(int *a,int *b);
void main()
{
int *a,*b;
clrscr();
printf("Enter no a and b : ");
scanf("%d %d",&a,&b);
printf("Before swap, A : %d B: %d",a,b);
swape(&a,&b);
printf("\nAfter swap, A : %d B: %d",a,b);
getch();
}
void swape(int *x,int *y)
{
int *temp;
*temp=*x;
*x=*y;
*y=*temp;
}
Output :

No comments:
Post a Comment