# include <stdio.h>
void swap(int *p,int *p1){
int *temp;
temp=*p;
*p=*p1;
*p1=temp;
}
int main(int argc,const char*argv[]){
int a,b;
printf("请输入a,b的值,中间用逗号隔开\n");
scanf("%d,%d",&a,&b);
printf("确认输入的数值:a=%d,b=%d\n",a,b);
swap(&a,&b);
printf("交换后的数值:a=%d,b=%d\n",a,b);
return 0;
} |
|