有以下成序,输出结果( )。 #include void main() { static int b[][3]={{1,2,3},{4},{5,6}}; b[0][2]=12,b…[2]=18: cout

admin2013-09-11  7

问题 有以下成序,输出结果(    )。
#include
    void main()
    {
    static int b[][3]={{1,2,3},{4},{5,6}};
    b[0][2]=12,b…[2]=18:
    cout<<**b<<“\t”<<**(b十1)<<“\t”<<**(b+1)<<“\t”<<*(*(b+1)+2)<<“Ln”:
    cout<    }

选项 A、1  4 4  1 8
   30
B、1  1  4 4
   18
C、4 4  1 8  1
   1
D、4 4 4 30
   1

答案A

解析 本题b是一个3×3的二维数组:利用指针表示数组:*(*(数组名+i)+j)。**b表示b[0][0]元素,值是1,**(1)+1)表示是b[0][1]的元素,值是4。*(*(b+1)+2)表示b[1][2]的元素,值是18,b[0][2]+b[1][21+b[2][2J之和是30。
转载请注明原文地址:https://kaotiyun.com/show/O7ID777K
0

随机试题
最新回复(0)