Enums#
An enum is a named set of integer constants. Values default
to 0, 1, 2… but you can pin them.
enum state {
STATE_IDLE,
STATE_RUNNING,
STATE_DONE = 9
};
enum state s = STATE_IDLE;
Enum constants are int; C23 lets the operator pin a
narrower underlying type.
References#
Unions for the typical tag-plus-union pairing.
Primitives for the underlying
int.