Step Into C · Lesson 17 · Systems C
The Preprocessor
Macros, conditional compilation, include guards and multi-file projects.
- ~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.
Lines beginning with # are handled by the preprocessor, which runs before the compiler and works on text. It knows nothing about C types. It just rewrites your source.
In this lesson
- Text substitution before compilation
- #include
- Object-like macros: constants
- Function-like macros
- Useful predefined macros
- Conditional compilation
- Include guards
- Stringizing and token pasting
- Multi-file programs
Missions
- A safe SQUARE
- Where am I?
- Which platform?
- Macro toolbox