#include<stdio.h>int fun(int a,int b){ int temp; temp=a; a=b; b=temp; return a,b;}void main(){ int a,b; scanf("%d%d",&a,&b);printf("%d,%d",a,b);}
1 回答
已采纳
望远
TA贡献1017条经验 获得超1032个赞
#include<stdio.h>
//采用指针,进行地址传递
void fun(int *a,int *b)
{
int temp;
temp=*a;
*a=*b;
*b=temp;
}
void main()
{
int a,b;
scanf("%d%d",&a,&b);
fun(&a,&b);
printf("%d,%d\n",a,b);
}
- 1 回答
- 0 关注
- 1460 浏览
添加回答
举报
0/150
提交
取消
