+ 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.

15th Dec 2019, 8:45 AM
Silman
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".
15th Dec 2019, 12:23 PM
Mark
+ 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.
15th Dec 2019, 11:55 AM
Avinesh
Avinesh - avatar
+ 2
What is the actual answer? Is the control passed to the macro or not?
15th Dec 2019, 10:53 AM
Avinesh
Avinesh - avatar
0
Avinesh in the quiz the correct answer is false, i.e. the control is not passed to the macro.
15th Dec 2019, 11:51 AM
Silman