选择题
16.
有以下程序,输出结果______。
#include <iostream.h>
void main()
{ static intb[][3]={{1,2,3},{4},{5,6}};
b[0][2]=12,b[1][2]=18;
cout << **b<<"\t"<<**(b+1)
<<"\t"<<* *(b+1)<<"\t"<<*(*(b+1)+2)<<"\n";
cout<<b[0][2]+b[1][2]+b[2][2]<<endl;
}
A.
B.
C.
D.
A、
A
B、
B
C、
C
D、
D
【正确答案】
A
【答案解析】
本题b是一个3×3的二维数组:利用指针表示数组:*(*(数组名+i)+j)。**b表示b[0][0]元素,值是1,**(b+1)表示是b[0][1]的元素,值是4。*(*(b+1)+2)表示b[1][2]的元素,值是18,b[0][2]+b[1][2]+b[2][2]之和是30。
提交答案
关闭