#include<stdio.h>
void fun(int *a, int *b, int *c)
{
int *temp;
temp=a;
a=b;
b=temp;
*temp=*b;
*b=*c;
*c=*temp;
}
int main()
{
int a,b,c,*p1,*p2,*p3;
a=5;
b=7;
c=3;
p1=&a;
p2=&b;
p3=&c;
fun(p1,p2,p3);
printf("%d,%d,%d\n",a,b,c);
return 0;
}
问题:fun函数中的运行过程,有大神可以帮忙解释一下吗?
函数参数传递方式:传值和传地址的问题
最新推荐文章于 2022-04-09 17:03:21 发布