A-A+

下列程序的输出结果是()。 #include <stdio.h> int b=2; int

2022-08-06 02:04:01 问答库 阅读 174 次

问题详情

下列程序的输出结果是()。 #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的值。

考点:程序