ProgrammingHardTCS NQT · Infosys

What is printed?

What is printed?
#include <stdio.h>
int main(void) {
    printf("%d", (1, 2));
}
  1. A. 1
  2. B. 3
  3. C. 0
  4. D. 2

Correct answer: D. 2

The parentheses form a comma expression, whose value is its right operand, 2. The comma here is an operator, not an argument separator.

More C Programming questions

Exams that ask this topic