#include<stdio.h>
int swap(int *a,int *b)
{
int temp;
temp=*a;
*a=*b;
*b=temp;
}
main()
{
int x,y;printf("请输入x与y的值,用空格隔开\n");
scanf("%d %d",&x,&y);
printf("x=%d,y=%d\n",x,y);
swap(&x,&y);
printf("交换后\nx=%d,y=%d\n",x,y);
}
#include<stdio.h>
int swap(int *a,int *b)
{
int temp;
temp=*a;
*a=*b;
*b=temp;
}
main()
{
int x,y;printf("请输入x与y的值,用空格隔开\n");
scanf("%d %d",&x,&y);
printf("x=%d,y=%d\n",x,y);
swap(&x,&y);
printf("交换后\nx=%d,y=%d\n",x,y);
}