ProgrammingModerateTCS NQT · Infosys

uint16_t a = 3, b = 5; printf("%d", (a - b) > 0); prints what?

  1. A. 0
  2. B. 1
  3. C. -2
  4. D. 65534

Correct answer: A. 0

Both operands are promoted to int, so a - b is -2 and the comparison is false. The wrap to 65534 happens only if the difference is stored back into a uint16_t first.

More C Programming questions

Exams that ask this topic