以下程序的输出结果是( )。 {int x;int*y;}*p; int dt[4]={1,2,3,4}; struct st aa[4]={2,&dt[0],3,&dt[0],4,&dt[0],5,&dt[0],}; {p=

admin2011-06-10  20

问题 以下程序的输出结果是(    )。    {int x;int*y;}*p;    int dt[4]={1,2,3,4};    struct st aa[4]={2,&dt[0],3,&dt[0],4,&dt[0],5,&dt[0],};    {p=aa;    pfintf("%d\n",++(p->x));    }

选项 A、1
B、2
C、3
D、4

答案C

解析 程序首先将指针p指向结构体数组aa的首地址,通过p->x引用了结构体数组aa[0]的第一个成员2;++(p->x)是将p->x的值加1,所以输出结果为3。
转载请注明原文地址:https://kaotiyun.com/show/utPp777K
0

最新回复(0)