ProgrammingHardWipro · Cognizant pattern

What is printed?

What is printed?
#define CONCAT(a, b) a ## b
int xy = 100;
printf("%d", CONCAT(x, y));
  1. A. 100
  2. B. Compilation error: a and b are not valid identifiers to paste
  3. C. 0
  4. D. xy

Correct answer: A. 100

The ## operator pastes its operands together at the token level before macro expansion completes, so CONCAT(x, y) becomes the single identifier xy, referring to the existing variable xy = 100.

More C Programming questions

Exams that ask this topic