题目内容

若有以下定义,能正确引用id成员值为4001的是( )。struct Machine {int id; float length; }a[3]={{4001,156.3},{4002,167.5},{4003,160}};struct Machine *p;p=a;

A. p->id
B. (p+1)->id
C. id
D. (a+1)->id

查看答案
更多问题

以下程序段的运行结果是( )。struct Player {int id; float h,w; };struct Player a={1601,182.5,75};struct Player b={1602,185.5,72.5};if(a.w>b.w) printf("%d\n",a.id);else printf("%d\n",b.id);

A. 182.5
B. 1601
C. 1602
D. 185.5

以下程序段的运行结果是( )。struct M {int id; int length; };struct M a={101,156};struct M b={102,167};struct M c={103,160};int i;i=a.length+b.length-c.length;printf("%d\n",i);

A. 163
B. 171
C. 169
D. 327

若有以下定义,能正确输出letter成员值为'D'的语句是( )。struct Table {int id; char letter; };struct Table a[5]={{1,'A'},{2,'B'},{3,'C'},{4,'D'},{5,'E'}};

A. printf("%c\n",a[3].letter);
B. printf("%c\n",a.letter);
C. printf("%c\n",letter);
D. printf("%c\n",a.letter[3]);

若已定义:struct st { int num; struct ym { int y; int m; }birthym; }st1;下列能对结构变量st1的成员y进行正确赋值的是( )。

A. st.birthym.y=1998;
B. st1.struct ym.y=1998;
C. st1.birthym.y=1998;
D. birthym.y=1998;

答案查题题库