Recall & Review
beginner Click to reveal answer
What is the main purpose of a preprocessor in C?
The preprocessor prepares the code before actual compilation by handling directives like #include, #define, and conditional compilation.
beginner Click to reveal answer
How does the #include directive help in C programming?
It inserts the contents of a specified file into the source code, allowing code reuse and modular programming.
beginner Click to reveal answer
Why do programmers use #define in C?
To create symbolic constants or macros that make code easier to read and maintain.
intermediate Click to reveal answer
What is conditional compilation and why is it useful?
It allows parts of code to be compiled only if certain conditions are met, helping to write portable and configurable programs.
beginner Click to reveal answer
When does the preprocessor run during the build process?
It runs before the compiler, transforming the source code by processing directives.
What does the #define directive do in C?
✗ Incorrect
The #define directive creates macros or symbolic constants before compilation.
Which stage processes #include directives?
✗ Incorrect
The preprocessor handles #include by inserting file contents before compilation.
Why use conditional compilation (#ifdef)?
✗ Incorrect
Conditional compilation includes or excludes code based on conditions, useful for portability.
When does the preprocessor run?
✗ Incorrect
The preprocessor runs before the compiler to prepare the source code.
Which of these is NOT a preprocessor directive?
✗ Incorrect
int main() is a function definition, not a preprocessor directive.
Explain why the C preprocessor is important before compilation.
Think about what happens to the code before the compiler sees it.
You got /4 concepts.
Describe how conditional compilation can help make programs portable.
Consider writing code that works on many computers.
You got /4 concepts.
