ProgrammingModerate

char name[8] = "Sam"; printf("%d %d", (int)sizeof name, (int)strlen(name)); What is printed?

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

Correct answer: B. 8 3

The array holds eight bytes including the padding, and the string has three characters.

More C Programming questions

Exams that ask this topic