A-A+

有以下说明和定义语句struct student{ int age; char num[8]

2022-08-06 00:50:08 问答库 阅读 174 次

问题详情

有以下说明和定义语句
struct student
{ int age; char num[8];};
struct student stu[3]={{20,"200401"},{21,"200402"},{109,"200403"}};
struct student *p=stu;
以下选项中引用结构体变量成员的表达式错误的是
A.(p++)->num
B.p->num
C.(*p).num
D.stu[3].age

参考答案

正确答案:D
解析:通过结构体变量引用其成员用“.”,通过结构体指针引用其成员用“— —>”,本题中选项A、B和C引用其成员变量都正确,选项D数组越界。

考点:语句,定义