C语言用函数如何实现两个数交换?答: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);} ...
C语言用函数如何实现两个数交换?答: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);} ...