ProgrammingVery hard

printf("%d", 1 && 0 || 2); What is printed?

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

Correct answer: A. 1

&& binds tighter than ||, so the result is (1 && 0) || 2, and the logical OR yields 1, not 2.

More C Programming questions

Exams that ask this topic