下列程序的输出结果是 #include<iostream.h> int b=2; int func(int *a) {b+=*a;return(b) ;} void main( )

admin2010-03-29  16

问题 下列程序的输出结果是          #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

答案2

解析 在函数体语句中的b+=*a;的 *是指针运算符(也称间接访问运算符),*a就是main函数中a的值。
转载请注明原文地址:https://kaotiyun.com/show/Ijjp777K
0

相关试题推荐
最新回复(0)