ProgrammingHardGATE CS · Campus placements

int i = 0; if (0 && i++) ; if (1 || i++) ; printf("%d", i); What is printed?

  1. A. 0
  2. B. 1
  3. C. 2
  4. D. undefined

Correct answer: A. 0

Both && and || short-circuit, so i++ is never evaluated in either statement. i stays 0.

More C Programming questions

Exams that ask this topic