首页 > 计算机类考试
题目内容 (请给出正确答案)
[单选题]

有以下定义和语句: struct workers {int num;char name;char C; struct {int day;int month;int year;)S; }; struct workers w,*pw; pw=&w; 能给w中year成员赋1980的语句是()

A.*pw.year=1980

B.w.year=1980

C.pw->year=1980

D.w.S.year=1980

答案
收藏

D、w.S.year=1980

解析:结构workers中的成员s是一个嵌套的结构类型定义,因此在给year赋值时,要用“.”运算在深入一层访问到最基本的成员year,只有D项反映出了这一点。

如果结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能还需要:
您的账号:
发送账号密码至手机
发送
安装优题宝APP,拍照搜题省时又省心!
更多“有以下定义和语句: struct workers {int …”相关的问题
第1题
若有以下定义的语句:struct student{ int age; int num;};struct student stu[3]={{1001,20},{10

若有以下定义的语句: struct student { int age; int num;}; struct student stu[3]={{1001,20},{1002,19},{1003,21}}; main() { struct student *p; p=stu; …} 则以下不正确的引用是()。

A.(p++)->num

B.p++

C.(*p).num

D.P=&stu.age.

点击查看答案
第2题
设有以下说明语句,则下面叙述不正确的是()。

struct wok{ int x; float y; double z; }aab;

A.struct是结构体类型的关键字

B.struct work是用户定义的结构体类型

C.aab是用户定义的结构体类型名

D.x,y和z都是结构体成员名

E.x和y共用内存

点击查看答案
第3题
若有以下定义的语句 struct student { int age; int num; }; struct student stu[3]={{1001,20},

若有以下定义的语句

struct student

{ int age;

int num; };

struct student stu[3]={{1001,20},{1002,19},{1003,21}};

main()

{ struct student *p;

p=stu;

… }

则以下不正确的引用是

A.(p++)->num

B.p++

C.(*p).num

D.P=&stu.age.

点击查看答案
第4题
设有以下说明语句structstu{inta;floatb;}stutype;则下列叙述不正确的是()。

A.struct是结构体类型的关键字

B.structstu是用户定义的结构体类型

C.stutype是用户定义的结构体类型名

D.a和b都是结构体成员名

点击查看答案
第5题
设有如下定义:struct sk{int a;float b;} data;int*p; 若要使p指向data中的a域,正确的赋值语句是

设有如下定义: 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=a;

点击查看答案
第6题
根据下面的定义,能打印出字母M的语句是()。struct person{char name[9];int age;}; structpersonc

根据下面的定义,能打印出字母M的语句是()。 struct person { char name[9]; int age; }; struct person class[10]={"John",17,"Paul",19,"Mary",18,"Adam",16};

A.printf("%c\n",class[3].name};

B.printf("%c\n",class[2].name[0]);

C.printf("%c\n",class[3].name[1]);

D.printf("%c\n",class[2].name[1]);

点击查看答案
第7题
设有定义语句“struct {int a;float b;char c;}abc;", 则对结构体成员a的引用可

以是()。

A.abc.a

B.abc-a

C.abc>a

D.abc->a

点击查看答案
第8题
设有定义:struct person{int ID;char name;}P;请将scanf(“%d”());语句补充完整 使其能够为

A.struct person

B.{int ID;char name[12];}P

C.请将scanf(%d,);语句补充完整,使其能够为结构体变量P的成员ID正确读人数据

点击查看答案
第9题
根据定义: struct person{char name[9];int age;}; struct person c[10]={"John",17,"Paul",19,"Mary",18,"Adam",16}; 能打印出字母M的语句是: ()

A.printf("%s",c[0].name);

B.printf("%s",c[1].name[0]);

C.printf("%s",c[2].name[1]);

D.printf("%s",c[3].name[2]);

点击查看答案
第10题
设有以下说明语句:struct ex{int x;float y;char z;} example;则下面叙述中不正确的是()。A.struc

设有以下说明语句: struct ex {int x;float y;char z;} example;则下面叙述中不正确的是()。

A.struct是结构体类型的关键字

B.example是结构体类型名

C.x,y,z都是结构体成员名

D.struct ex是结构体类型名

点击查看答案
第11题
设有以下结构类型说明和变量定义,则变量a在内存所占字节数是【 】。 struct stud { char num[6
]; int s[4]; double ave; } a,*p;

点击查看答案
退出 登录/注册
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改