#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,*x,*y;
printf("a=");
scanf("%d",&a);
printf("\nb=");
scanf("%d",&b);
x=&a;
y=&b;
*x=*x+*y;
*y=*x-*y;
*x=*x-*y;
printf("after swapping\n");
printf("a=%d",*x);
printf("\na=%d",*y);
}
#include<conio.h>
void main()
{
int a,b,*x,*y;
printf("a=");
scanf("%d",&a);
printf("\nb=");
scanf("%d",&b);
x=&a;
y=&b;
*x=*x+*y;
*y=*x-*y;
*x=*x-*y;
printf("after swapping\n");
printf("a=%d",*x);
printf("\na=%d",*y);
}
No comments:
Post a Comment