阅读下面程序: #include fun(int a’int b) {int c; c=a+b: return c; } void main0 {int x=6,y=7,z=8,r;

admin2019-04-18  27

问题 阅读下面程序:
    #include
    fun(int a’int b)
    {int c;
    c=a+b:
    return c;
    }
    void main0
    {int x=6,y=7,z=8,r;
    r=fun((x一,y++,x+y),Z一);
    cout<    }
则该程序的输出结果是(    )。

选项 A、11
B、20
C、21
D、31

答案C

解析 由主函数入手,定义变量x、y、z,然后调用函数fun,其中的参数为(x一,y++,x+y)的计算结果和z一的计算结果,所以调用fun(13,8)计算结果为21。
转载请注明原文地址:https://jikaoti.com/ti/h7t0FFFM
0

最新回复(0)