ProgrammingModerate

printf("%d", !5 + !0); What is printed?

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

Correct answer: B. 1

! yields 1 for a zero operand and 0 for any nonzero one, so !5 = 0 and !0 = 1, giving 1. 2 wrongly takes !5 as 1, and 6 ignores the first ! entirely.

More C Programming questions

Exams that ask this topic