Suppose someone writes increment macro (i.e. which increments the value by one) in following ways:
Pick the correct statement for the above macros.
(A) Only INC1 is correct.
(B) All (i.e. INC1, INC2, INC3 and INC4) are correct.
(C) Only INC1 and INC3 are correct.
(D) Only INC1 and INC2 are correct.
Explanation: In C, for macros with arguments, there can’t be any space between macro name and open parenthesis. That’s why only INC1 and INC3 are correct. Basically, “#define INC2 (a) ((a)+1)” results in “INC2” expansion to “(a) ((a)+1)” which is not the desired expansion.
Quiz of this Question