LearnFrenzy
Sign in Take a free test

Strings · String Basics MCQ · Question 1

Size of char s[] = "Hello" in C Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 1 Back to Exercise

How many bytes does char s[] = "Hello"; occupy?

  • A 5
  • B 6 Correct
  • C 4
  • D 8
Correct Answer: Option B

The compiler sizes the array from the literal, including the terminating '\0': 5 letters + 1 = 6 bytes. strlen(s) would be 5.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links