枚举型是四种基本数据类型之一。常量、字符型、布尔型可以用来表达数,字符,真假的描述。但我们还是觉得有点缺欠:它们不能方便地进行一些标识符的描述,如:红,橙,黄,绿,青,蓝,紫七种颜色,要在数据类型中要把它们直接表达出来,我们觉得有障碍。而在计算机内有没有这种数据类型,能够很方便地将它们表示出来?有,枚举型能办到。用四种基本数据类型不便表示的标识符,而且这些标识符的数量是有限的,我们可以用枚举的方法来表达它,把要用的所有标识符全部枚举出来。这种方法比较接近自然语言的表达。
...ol*基本类型有序型字符型(char)整型(int、short、long)布尔型(bool)浮点型单精度型(float)双精度型(double)构造类型枚举型(enum)数组结构体(struct)共用体(union)类(class)指针类型*修饰符在C中描述为了更加准确的描述数据类型提供了个关键字用来修饰基本的数...
基于310个网页-相关网页
在常量表达式,比如枚举型常量、位域的宽度或是静态变量的初始值,是不允许使用在这种声明中的。
Embedded statements are not allowed in constant expressions, such as the value of an enumeration constant, the width of a bit-field, or the initial value of a static variable.
PAT和EFAT能接受多种数据类型,包括整型、布尔型、浮点型、枚举型变量和有限大小的数组。
PAT and EFAT accept several data types, such as integers, Booleans, floats, enumerates and fixed-size arrays.
常数可以是整数、字符、浮点数、字符串、Boolean、octet或枚举型,但不能是any类型或用户定义的类型。
Your constants can be integer, character, floating-point, string, Boolean, octet or enumerated but not of type any or a user-defined type. Here are some examples.
应用推荐