ProgrammingModerateTCS NQT · Infosys

char s[4] = "abc"; What is sizeof s?

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

Correct answer: B. 4

The array has four elements, which is the size declared, and the string fills three of them with a terminator in the fourth.

More C Programming questions

Exams that ask this topic