A-A+

下列语句段中 正确的是()。A.struct{int x;float y;int a[2];

2022-08-06 04:58:38 问答库 阅读 176 次

问题详情

下列语句段中,正确的是()。
A.struct{int x;float y;int a[2];unsigned b[3];char name[10];};
B.struct stu{unsigned a[3];unsigned b[4];}x;int*p=&x.a;
C.struct stu{int a;float x[4];}y={1,1.0};float data=y.x;
D.struct nd{int a,b;unsigned c[2]=5;};

参考答案

正确答案:A
解析: 本题主要考查的知识点是结构类型的概念和定义,结构定义的一般形式:
struct结构类型名称
{数据类型成员名1;
数据类型成员名2;

数据类型成员名n;
};
struct为关键字,是结构的标识符;{}中包围的是组成该结构的成员项;每个成员的数据类型既可以是简单的数据类型,也可以是复杂的数据类型。整个定义作为一个完整的语句,用分号结束。结构类型名称是可以省略的,此时定义的结构称为无名结构。

考点:语句