Given the macro #define STR(x) #x, what does printf(“%s”, STR(a + b)); print in C?
Correct answer B. a + b
Explanation
The # operator in a function-like macro turns the macro argument into a string literal, so STR(a + b) becomes "a + b". The variables a and b do not even need to exist, because no evaluation happens. This stringising operator is used in assert-style macros to print the text of a failed expression.
Answer checked How we write and check questions
Discussion