Step Into C · Lesson 13 · Modeling Data
typedef, enum & union
Naming types the Windows way, enumerations, unions and type punning.
- ~30 minreading and coding
- 4missions
- membersaccess
- Clanguage
Part of Step Into C. The full lesson, its missions and the real compiler and debugger are in the course. Try a free lesson first to see how it works.
typedef creates an alias for an existing type. It does not create a new type. It just gives you a shorter or more meaningful name.
In this lesson
- typedef: give a type a new name
- The Windows struct idiom
- enum: named integer constants
- union: many views of the same bytes
Missions
- Windows-style typedef
- Enumerations
- One value, four bytes
- Status codes