A-A+
下列程序的输出结果是()。 #include <stdio.h> int b=2; int
问题详情
下列程序的输出结果是()。 #include <stdio.h> int b=2; int func(int *a) { b+=*a;return(b);} main() { int a=2, res=2; res+=func(&a); printf("%dn",res); }
A.4
B.6
C.8
D.10请帮忙给出正确答案和分析,谢谢!
参考答案
正确答案:B
解析:对于函数体中的语句b+=*a;其中的“*”是指针运算符,*a就是main函数中变量a的值。