题目内容

设有如下定义:struct sk{ int a;float b;}data;int *p;若要使p指向data中的a成员,正确的赋值语句是( )。

A. p=&a;
B. p=data.a;
C. p=&data.a;
D. *p=data.a;

查看答案
更多问题

根据下面的定义,能打印出字母m的语句是( )。struct person{ char name[9];int age;}per[10]={"john",17,"paul",19,"mary",18,"adam",16};

A. printf("%c\n",per[3].name);
B. printf("%c\n",per[3].name[1]);
C. printf("%c\n",per[2].name[1]);
D. printf("%c\n",per[2].name[0]);

以下程序的输出结果是( )。#include struct stu{ int num;char name[10];int age;};int main(){struct stu st[3]={{9801,"Zhang",20},{9802,"Wang",19},{9803,"Zhao",18;printf("%s\n",(*(st+2)).name);return 0;}

A. Zhang
B. Zhao
C. Wang
D. 18

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

A. 12
B. 23
C. 14
D. 32

以下程序的输出结果是( )。#include struct st{ int x;int *y;}*p;int dt[4]={10,20,30,40};struct st aa[4]={50,&dt[0],60,&dt[1],70,&dt[2],80,&dt[3]};int main(){ p=aa;printf("%d,",++p->x);printf("%d,",(++p)->x);printf("%d\n",++(*p->y));return 0;}

A. 10,20,20
B. 50,60,21
C. 51,60,21
D. 60,70,31

答案查题题库