A-A+
有以下程序: include <stdio.h> void f(int y int *x)
问题详情
有以下程序: include <stdio.h> void f(int y,int *x) { y=y+ *x; *x=*x+y;} main() { int x=2,y=4; f(y,&x); printf("%d%dn",x,Y); } 执行后的输出结果【 】。
请帮忙给出正确答案和分析,谢谢!
参考答案
正确答案:8 4
f函数中变量x传的是变量的地址,而变量y是传的值,调用函数f后,虽然f函数中的。x变为8,y值也变了,但main函数中的y未变,仍然为4。