[英]Enumeration syntax
Can someone please explain to me which part is what in this:
有人可以向我解释一下这是哪一部分吗:
enum bb { cc } dd;
I understand that enum bb is the name of the enumeration and that { cc } is its enumerator, but I have no clue what dd is.
我知道enum bb是枚举的名称,而{ cc }是它的枚举器,但我不知道dd是什么。
enum bb
{
cc
} dd;
bb - enum tag. bb - 枚举标签。cc - enumerator constant. cc - 枚举常量。 As it is first and it does not have an expicity defined value it will be zero ( 0 );0 );dd - variable of type enum bb dd - enum bb类型的变量It can be written as:
它可以写成:
enum bb
{
cc
};
enum bb dd;
It defines dd as a variable of the type enum bb .
它将dd定义为enum bb类型的变量。 Take a look at Enumerations It behaves just like when you're defining normally
看一下Enumerations它的行为就像您正常定义时一样
#include <stdio.h>
int main()
{
enum bb { cc, ee } dd = cc; // dd is now 0
dd = ee; // dd is now 1
printf("%d", dd);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.