Before you can understand a single line of the parent note, you need to be fluent in the tiny alphabet of ideas it silently assumes. This page builds every one of them from nothing, in the order they depend on each other.
The picture: think of a row of numbered lockers stretching left and right. Each locker is a whole step from the next — you can stand on locker 3, but never between locker 3 and locker 4.
Why the topic needs it: every enum name is secretly one of these lockers. When the parent note says "an enum is just ints", it means each name is glued to exactly one whole-number locker. If you're shaky on what an integer is, see Integer Types in C.
The picture: a locker whose door is welded shut at locker 5. You can look at it, point at it, use its number — but you can never make that name mean a different locker later.
Why the topic needs it: every enumerator (defined in the next section) is a constant. Once a name means 0, it means 0 forever. This is different from a variable, which is a locker whose contents you can swap.
The picture: the enum is a row of jars; each jar with its name-label is one enumerator. RED is jar-0's label, GREEN is jar-1's label, and so on.
Why the topic needs it: the whole parent note is about enumerators — the recurrence in Section 7, the value(...) mapping, the switch cases and the array-index trick all operate on enumerators. You cannot follow a single formula until you know that the symbol ek stands for "the (k)-th enumerator". We define ek formally once we reach the subscript in Section 6.
We have used the word "enum" repeatedly — now we pin it down as a real piece of the C language.
The picture: the enumeration is the whole labelled shelf; each jar on it is an enumerator. enum is the sign hung above the shelf announcing "this is a shelf of named numbers".
The anatomy of the declaration, piece by piece:
keyword: "a named-int list follows"enumthe type’s tag/nameColorthe enumerators{ RED, GREEN, BLUE }
enum — the keyword that starts every enumeration.
Color — the tag, an optional name for this new type so you can later declare enum Color c;.
{ ... } — the braces holding the comma-separated enumerators.
Why the topic needs it: the parent's every example opens with enum. Until you know it's a keyword (not a name you invented) and that "enumeration" means the whole group while "enumerator" means one member, the sentence "an enum declares a new integer type whose values are a list of enumerators" is a tangle. To later drop the enum word from enum Color c; and just write Color c;, see typedef.
The picture: an arrow pointing from the number to the name — the number flows in and sticks.
enumerator nameRED"stands for"=value0
Why the topic needs it: the parent's "explicit values" (OK = 1) rely on this. Miss the difference and WARN = 5 looks like ordinary assignment when it is really a one-time welding of a name to a number.
The picture: lockers come in different sizes and shapes. A char locker is small; an int locker is bigger; an enum Color locker is the same size as an int but wears a sticky label saying "colours live here".
Why the topic needs it: the parent says "an enum declares a new integer type". Without knowing what a type is, that sentence is empty. And it explains the third mistake in the parent: enum Color is a label on an int-sized box, not a locked vault — you can still shove 99 in it.
The parent writes:
value(e0)=0,value(ek)=value(ek−1)+1
Three pieces of notation here are new. Let's earn them one at a time.
The picture: a shelf of named jars in a line. e0 is the leftmost jar, e1 the next, and so on. The subscript is the label under each jar telling you which slot it's in — not what's inside it.
The picture:value(…) is reading the number off the front of the jar. Point at a jar (an enumerator), and value tells you its locker number.
The picture: dominoes. Once the first jar's value is fixed at 0, each following jar reads its left neighbour's number and adds 1. Knock the first, they all fall into place.
Why "+1 and not ×2 or +2"? Because that is exactly the rule the C standard chose: it wanted the simplest, most predictable count — 0, 1, 2, 3 — so array indices and enum values line up perfectly. Any other step would break the array-sizing trick from the parent's example 4.
Before we can read the parent's printf(...) lines, we need the shape of a function call itself — the parent assumes it, so we build it here.
The picture: a vending machine. The name is the machine; the parentheses are the coin-slot; each argument is a coin you drop in. Push the button and out comes the result (here, printed text).
The picture:%d is a stencil shaped like a number. Whatever you pour through it comes out as digits — never as letters or names.
Why the topic needs it: the parent's first big mistake — "printing an enum gives its name" — dies here. printf("%d", RED) pours the number0 through the number-stencil, so you see 0, never "RED". There is no name inside the machine to print.
The picture: an egg carton. Box 0, box 1, box 2 ... you point at one by writing its slot number inside [ ].
Why the topic needs it: the parent's example int days[MONTH_COUNT]; uses that enumerator's value (3) as the size inside the array-creation brackets, and enum names as indices into it. Enum counting-from-0 and array counting-from-0 are deliberately the same, which is what makes the MONTH_COUNT sentinel trick work. See Arrays in C.
How to read the map below: each arrow means "the thing at the tail must be understood before the thing at the head." Follow the arrows and you are literally walking the safe learning order — start at the boxes with no incoming arrows (Integer), and every box you reach will only use ideas you have already passed through. The node Enumeration enum is the destination: notice how every foundation on this page eventually feeds into it, which is why you had to build them first.
Each box on the left is something this page built from zero; together they hold up the parent idea of an enumeration. Related type-building tools you'll meet nearby: struct in C, typedef, and the place enums shine most — the switch statement.