单选题
C语言
题号 #2252789
下述程序的输出结果是( )。
#include<stdio.h>
main()
{ int a[2][3]={{1,2,3),{4,5,6}},(*p)[3],i;
p=a ;
for(i=0;i<3;i++)
{ if(i<2)
p[1][i]=p[1][i]一1;
else
p[1][i]=1;)
printf("%d\n",a[0][1]+a[1][1]+a[1][2]);}
参考答案
B
答案解析
根据判断本题共进行三次for循环,第一次执行for循环,p[1][0]=p[1][0]-1=3;第2次执行for循环,p[1][1]=p[1][1]-1=4;第3次执行for循环,[1][2] =1,最后输出的是a[o][1]+a[1][1]+a[1][2]=2+4+ 1=7。
你可能感兴趣的试题
A.
strcpy(str2,strl)
B.strcpy(str3,strl)
C.strcpy(strl,str2)
D.strcpy(str5,strl)
A.1
B.4
C.9
D.0
A.
(*p).data.a
B.(*p).a;
C.p->data.a
D.p.data.a