A-A+
若有以下结构体定义 则是正确的引用或定义。struct example{ int x; in
问题详情
若有以下结构体定义,则是正确的引用或定义。struct example{ int x; int y;}v1;
A.example.x=10
B.examplev2.x=10
C.struct v2;v2.x=10
D.struct example v2={10};请帮忙给出正确答案和分析,谢谢!
参考答案
正确答案:D
解析:在定义结构体变量时,不能只用结构体名example或关键字struct进行定义,必需要用结构体类型名structexample定义,在引用结构体成员变量时,需要用结构体变量名进行引用,所以选D。