Difficulty: Easy
Correct Answer: Correct
Explanation:
Introduction / Context:
The preprocessor transforms the source code before it reaches the compiler. Understanding whether macros persist helps explain why debugging sometimes cannot “step into” a macro and why preprocessed output looks different from original files.
Given Data / Assumptions:
Concept / Approach:
During preprocessing, macro invocations are expanded into raw tokens; #include directives are replaced by the contents of the target headers; #if/#ifdef sections are conditionally kept or removed. Macro definitions and directive lines are not passed to the compiler as such; instead, only the expanded tokens remain, often with #line markers for debugging.
Step-by-Step Solution:
Write code with #define MAX(a,b) ((a) > (b) ? (a) : (b)).The preprocessor replaces each MAX(x,y) with ((x) > (y) ? (x) : (y)).The directive #define itself is not present in the compiler’s input; only the expanded forms and bookkeeping lines remain.
Verification / Alternative check:
Use the compiler’s “preprocess only” option to inspect the expanded file. You will not see #define lines, only the effect of those definitions.
Why Other Options Are Wrong:
“Incorrect” suggests macros persist, which is false; suggesting only certain macro kinds are removed is also wrong—both object-like and function-like macros are handled during preprocessing; “They remain but are ignored” mischaracterizes the pipeline.
Common Pitfalls:
Expecting to step into macros with a debugger; forgetting to parenthesize macro parameters; assuming macro scope behaves like runtime variables.
Final Answer:
Correct
Discussion & Comments