gpt4 book ai didi

C 中的枚举可以使用 (*,/,&,^) 等符号吗?

转载 作者:行者123 更新时间:2023-11-30 21:42:14 30 4
gpt4 key购买 nike

我想在 C 中使用枚举类型。我知道如何使用它们,但我有一个问题。我有一个这样的例子

enum S { A,B,C,G };

我知道这可行,但我可以做这样的事情吗?

enum S {^,*,/,%};

感谢您的宝贵时间。

最佳答案

没有。 C 中的标识符(变量、函数和类型名称)只能使用字母数字字符和下划线。并且标识符不能以数字开头。此外,您不能使用某些保留关键字。

http://www.cprogrammingexpert.com/C/Tutorial/fundamentals/identifiers.aspx (链接已损坏)

更新:未损坏的新链接: https://www.w3schools.in/c-programming/identifiers

关于C 中的枚举可以使用 (*,/,&,^) 等符号吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30737541/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com