ProgrammingModerate

char w[] = "ab", z[2] = "ab"; printf("%zu", sizeof w + sizeof z); What is printed?

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

Correct answer: B. 5

w has three bytes with its terminator. z has exactly two bytes and no terminator, which is legal as long as no string function is called on it. 3 + 2 = 5.

More C Programming questions

Exams that ask this topic