开发者

Enum values from non-integer literals?

开发者 https://www.devze.com 2023-02-27 10:10 出处:网络
Is it possible in C to declare enum value开发者_运维技巧s from anything other than integer literals?No. enums are constants with type int.

Is it possible in C to declare enum value开发者_运维技巧s from anything other than integer literals?


No. enums are constants with type int.

Just a small addition: http://en.wikipedia.org/wiki/Enumerated_type#C_and_syntactically_similar_languages


Any expression that is composed of integer literals in the broad sense (343, 'a', L'ß') other enum, and sizeof expressions.

I am not so sure but maybe also offsetof expressions.

0

精彩评论

暂无评论...
验证码 换一张
取 消