An enumeration defines a C type with named integer values. Constants may receive positional values starting at zero or explicit values. section 5.6.2
Name values and index an array
enum corvid { magpie, raven, jay, chough, corvid_num }; char const*const bird[corvid_num] = { [chough] = "chough", [raven] = "raven", [magpie] = "magpie", [jay] = "jay", }; The enumeration fixes the indices, so array entries can be written in a different order and a new corvid can be inserted before corvid_num. section 5.6.2
Keep these rules in mind:
- Treat enumeration constants as the main practical benefit for small values; enumeration objects convert to signed or unsigned types during indexing and arithmetic. section 5.6.2
- Use integer constant expressions for enumeration values; ordinary objects such as const-qualified variables cannot participate. section 5.6.2






















