Recall & Review
beginner
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.
Click to reveal answer
beginner
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.
Click to reveal answer
beginner
Why do programmers use #define in C?
To create symbolic constants or macros that make code easier to read and maintain.
Click to reveal answer
intermediate
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.
Click to reveal answer
beginner
When does the preprocessor run during the build process?
It runs before the compiler, transforming the source code by processing directives.
Click to reveal answer
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.