ProgrammingModerate

struct Score { char name[5]; int pts; }; struct Score s = {"Amy", 7}; printf("%d", (int)strlen(s.name)); What is printed?

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

Correct answer: B. 3

The name is Amy with a terminator, and strlen counts the three letters.

More C Programming questions

Exams that ask this topic