若有以下程序段 struct st{ int n; struct st *next; }; struct st a[3]={ 5,&a[1],7,&a[2],9,’\0’ }, *p; p=&a[0]; 则以下选项中值为6的表达

admin2021-04-28  25

问题 若有以下程序段
    struct  st{ int n; struct st *next; };
    struct st a[3]={ 5,&a[1],7,&a[2],9,’\0’ },  *p;
    p=&a[0];
则以下选项中值为6的表达式是

选项 A、p->n
B、(*p).n
C、p->n++
D、++(p->n)

答案D

解析 本题考查结构体变量的引用,其中a为定义的结构体数组,D选项中p->n为5,++(p->n)为6,所以D选项正确。
转载请注明原文地址:https://jikaoti.com/ti/cnz0FFFM
0

随机试题
最新回复(0)