【发布时间】:2018-11-21 15:11:31
【问题描述】:
#include <stdio.h>
#include <stdbool.h>
typedef enum{
False,
True
}Bool;
int main(int argc, char const *argv[])
{
int a = 1, d = 1;
Bool b = False, c = True;
Bool ans;
if (a == d)
{
ans = c;
}
else
{
ans = b;
}
printf("The answer is: %i \n", ans);
return 0;
}
我认为它只是返回执行结果 0 或 1。 我希望它从我创建的枚举中返回值。
【问题讨论】:
-
您认为枚举中的值在内部是如何表示的?
-
如果我将其更改为 TRuuue 和 Faaalse,它仍然返回 0 和 1。
-
更改名称与 Govind 的问题完全无关。更改枚举 (
{ True, False }) 中的 order 将非常重要。你是这个意思吗? -
那样的话,我是无能为力的。
标签: c