ProgrammingModerate

char s[3] = "ab"; printf("%zu", sizeof s); What is printed?

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

Correct answer: A. 3

The array is declared with three elements, so sizeof is 3 regardless of the two characters and terminator in it.

More C Programming questions

Exams that ask this topic