ProgrammingModerateTCS NQT · Infosys

int a = 7; printf("%d", a++ > 7); What is printed?

  1. A. 0
  2. B. 1
  3. C. 7
  4. D. 8

Correct answer: A. 0

a++ yields the old value 7, and 7 > 7 is false, so the program prints 0. The increment takes effect after the comparison operand is read.

More C Programming questions

Exams that ask this topic