Enum values from non-integer literals?
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.
精彩评论