-1
我很新的C和我给出的这些操作的指令:将枚举的数据类型转换为int类型?
“的枚举数据类型dfaState翻译成一个int 类型;因此,可变状态应该是一个int变量此外,映射枚举值EE。 ,OE,OO和EO分别为整数常数0,1,2和3。
这里是我给出的代码:
#include <stdio.h>
enum dfaState { EE, OE, OO, EO };
enum dfaState state = EE;
char input;
int main(void)
{
//main function here
}
我应该如何看待这些指令?我试过这个:
#include <stdio.h>
int EE = 0;
int OE = 1;
int OO = 2;
int EO = 3;
int state;
char input;
int main(void)
但我得到错误。任何帮助表示赞赏。
*但我收到错误*在编译时,在运行时是否看到错误?很高兴看到[最小,完整和可验证示例](http://stackoverflow.com/help/mcve)。 –
@RSahu他们是编译错误。 – flarp
@flarp你可能想要发布它们... – tangrs