以下程序的输出结果是( )。 #include<stdio.h> main() struct st {p=aa; {int x;int*y;}*p; printf("%d\n",++(p->x));} int dt[4]={1,2,3,4};

admin2022-11-11  28

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

选项 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/PX0D777K
0

相关试题推荐
最新回复(0)