+ 3
Unclear C quiz question: macro call, control
The question is whether the following statement is true or false: "In a macro call the control is passed to the macro." What is "the control"? The correct / actual answer is false.
4 Respostas
+ 4
Hi Silman
In a procedural language as C, the "control" would mean which function or procedure is currently active, i.e., being executed.
With this in mind and the knowledge that C macros are not functions but rather a copy and paste recipe to be used by the prepocessor during the compilation process, it is clear that a macro itself would not have the "contol".
+ 3
Silman see the macros are processed by the preprocessor and only after that the header files are loaded.
So when the execution starts from the main method from top to bottom, the interpreter checks line by line and whenever it sees a macro being used it just replaces the macro with its value in case of a constant is created so the control is never passed to the macro again.
+ 2
What is the actual answer?
Is the control passed to the macro or not?
0
Avinesh in the quiz the correct answer is false, i.e. the control is not passed to the macro.