以下选项中不能正确把c1定义成结构体变量的是

admin2009-01-15  17

问题 以下选项中不能正确把c1定义成结构体变量的是

选项 A、typedef struct    {int red:     int green:     int blue;    } COLOR;    COLOR c1;
B、struct color  c1    {int red     int green:     int blue;    };
C、struct color    {int red ,     int green :     int blue :    )cl;
D、struct    {int red;     int green;     int blue    } c1 ;

答案2

解析 本题考核的知识点是结构体类型定义。结构体类型的定义格式为:
strcut   结构体名
{成虽说明列表};
结构体变量的定义有3种形式:第一种,定义结构体型的同时定义结构体变量,如:strcut  结构体名  {成员说明列表}变量;选项C属于这种情况,故选项C正确:第二种,先定义一个结构体类型,然后使用该类型来定义结构体变量,如:strcut student{成员说明列表}:student  变量;选项A属于这种情况,故选项A正确;第三种,定义一个无名称的结构体类型的同时定义结构体变量,如:strcut student{成员说明列表}变量;选项D属于这种情况,故选项D正确.所以,4个选项中选项B符合题意。
转载请注明原文地址:https://kaotiyun.com/show/NnXp777K
0

相关试题推荐
最新回复(0)