下列程序的输出结果是#includeint b=2;int func(int * a){b+= * a; return(b) ;}voi
下列程序的输出结果是 #include<iostream.h> int b=2; int func(int * a) {b+= * a; return(b) ;} void main( ) { int a=2, res=2; res+=func(&a) ; cout < < res;}
A.4
B.6
C.8
D.10
正确答案:B解析:在函数体语句b+= * a;中的*是指针运算符(也称间接访问运算符) , * a就是main函数中a的值。
词条内容仅供参考,如果您需要解决具体问题
(尤其在法律、医学等领域),建议您咨询相关领域专业人士。
