enumeration type的意思|示意

美 / ɪˌnju:məˈreɪʃən taip / 英 / ɪˌnjuməˈreʃən taɪp /

[计] 枚举类型


enumeration type的用法详解

enumeration类型是C语言中用来表示值与字符串之间的映射关系的数据类型。它可以把一组相关的值结合起来,以便把值与特定的含义相关联。

enumeration类型定义的格式如下:

enum enumeration_name

{

list_of_enumerators

};

其中enumeration_name表示枚举类型的名称,list_of_enumerators为枚举变量的列表。

enumeration类型定义后,我们就可以使用它来定义变量,从而使用这些变量来指示特定的含义。例如:

enum color

{

RED,

GREEN,

BLUE

};

color c;

c = RED;

这里我们定义了一个新的enumeration类型color,并且定义了一个新的变量c,赋值为RED,表面示我们定义的枚举值RED的含义。

此外,我们也可以在enumeration类型定义的开始处指定枚举变量的值,这也是常见的情况:

enum color

{

RED=1,

GREEN=2,

BLUE=3

};

这里,我们指定了枚举变量RED的值为1,GREEN为2,BLUE为3。

enumeration类型可以让我们使用有意义的标识符来表示特定的值,这有助于我们以一种简单易懂的方式来表达程序中的概念。因此,在C语言程序设计中,enumeration类型经常被用到。

enumeration type相关短语

1、 enumeration type declaration 列举类型宣告

2、 enumeration type definition 列举类型定义

3、 enumeration type representation 列举类型表示法

4、 Declares an enumeration type 声明一个枚举类型

5、 enumeration type input 列举类型输入输出

6、 enumeration-type variables 枚举型变量

7、 data of enumeration type 枚举型数据

enumeration type相关例句

A class that helps define and represent an enumeration type.

帮助定义并表示枚举类型的类.

互联网

Enumeration type % 1 is not a known Special Enumeration type.

枚举类型%1不是已知的特殊枚举类型.

互联网

When using operators on enumerators, both operands must be of the enumeration type.

对枚举数使用运算符时, 两个操作数必须都是枚举类型.

互联网