以下选项中不能正确把cl定义成结构体变量的是A.typedef struct { int red; int green; int blue; } COLOR; COLOR cl;B.struct color cl { int red; int green; int blue; }C.struct color { int red; int green; int blue; } cl;D.struct { int red; int green; int blue; } cl;

题目

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

A.typedef struct { int red; int green; int blue; } COLOR; COLOR cl;

B.struct color cl { int red; int green; int blue; }

C.struct color { int red; int green; int blue; } cl;

D.struct { int red; int green; int blue; } cl;


相似考题
参考答案和解析
正确答案:B
解析:选项A)是把结构体类型改名后定义为变量cl。选项C),D)则是在定义结构体类型时定义变量,而选项B)不符合结构体类型定义的语法规则。
更多“以下选项中不能正确把cl定义成结构体变量的是A.typedef struct { int red; int green; ”相关问题
  • 第1题:

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

    A.struct color cl { int red; int green; int blue; }

    B.typedef struct { int red; int green; int blue; } COLOR; COLOR cl;

    C.struct color { int red; int green; int blue; } cl;

    D.struct { int red; int green; int blue; } cl;


    B

  • 第2题:

    【单选题】以下选项中不能正确把cl定义成结构体变量的是______。

    A.typedef struct {intred; int green; int blue; } COLOR; COLOR cl;

    B.struct color cl { int red; int green; int blue; };

    C.struct color { int red; int green; int blue; }cl;

    D.struct {int red; int green; intblue; }c1;


    B

  • 第3题:

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

    A.typedef struct { int red; int green; int blue; } COLOR; COLOR cl;

    B.struct color cl { int red; int green; int blue; };

    C.struct color { int red; int green; int blue; } c l;

    D.struct { int red; int green; int blue; } c l;


    struct color cl { int red; int green; int blue; };

  • 第4题:

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

    A.typedef struct { int red; int green; int blue; } COLOR; COLOR cl;

    B.struct color cl { int red; int green; int blue; };

    C.struct color { int red; int green; int blue; }cl;

    D.struct { int red; int green; int blue; } cl;


    B

  • 第5题:

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

    A.typedef struct { int red; int green; int blue; } COLOR; COLOR cl;

    B.struct color { int red; int green; int blue; } c l;

    C.struct color cl { int red; int green; int blue; };

    D.struct { int red; int green; int blue; } c l;


    B 解析:结构体类型的定义格式为: stract结构体名 成员说明列表}; 结构体变量的定义有3种形式:第一种,定义结构体类型的同时定义结构体变量,如: street结构体名{成员说明列表}变量;第二种,先定义一个结构体类型,然后使用该类型来定义结构体变量,如:strect student{成员说明列表};student变量;第三种,定义一个无名称的结构体类型的同时定义结构体变量,如:strect student{成员说明列表}变量;。