ProgrammingHard

int *p = NULL; if (p && *p == 3) puts("match"); else puts("no match"); What is printed?

  1. A. match
  2. B. undefined behaviour
  3. C. no match
  4. D. a crash

Correct answer: C. no match

The && stops at the NULL pointer, so *p is never read and the else branch runs.

More C Programming questions

Exams that ask this topic