ProgrammingVery hard

What does printf("%d", 8 & 7 == 0); print?

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

Correct answer: D. 0

== binds tighter than &, so the expression is 8 & (7 == 0) = 8 & 0 = 0. A power-of-two test needs parentheses: (8 & 7) == 0.

More C Programming questions

Exams that ask this topic