题目内容

设有以下定义,p指向num域的是( )struct student{ int num;char name[10];}stu,*p;

A. p=&stu.num;
B. *p=stu.num;
C. p=(struct student*)&(stu.num);
D. p=(struct student*)stu.num;

查看答案
更多问题

设有一结构体类型变量定义如下:struct date{ int year;int month;int day;};struct worker{ char name[20];char sex;struct date birthday;}w1;若对结构体变量w1的出生年份进行赋值,下面正确的赋值语句是( )

A. year=1976
B. birthday.year=1976
C. w1.birthday.year=1976
D. w1.year=1976

若有以下程序段:struct note{ int n;int *pn;};int a=1,b=2,c=3;struct notes[3]={{1001,&a},{1002,&b},{1003,&c}};struct note *p=s;则以下表达式中值为2的是( )

A. (p++)->pn
B. *(p++)->pn
C. (*p).pn
D. *(++p)->pn

若已经定义:structstu { int a, b; } student ;则下列输入语句中正确的是( )

A. scanf("%d",&a);
B. scanf("%d",&student);
C. scanf("%d",&stu.a);
D. scanf("%d",&student.a);

有如下定义:struct person {char name[9];int age;};struct personclass[10]={ "John",17, "Paul",19, "Mary",18,"Jack",19};根据上述定义,能输出字母M的语句是( )

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

答案查题题库