String size | Sololearn: Learn to code for FREE!

0

String size

In string, when I'm declaring the size of the string, do I need to declare 1 character more than the size? Like if the string is 10 character long then does the size need to be 11? If so then why?

2/23/2021 3:01:34 PM

Radib 77

3 Answers

New Answer

+1

Because every string has the end character: '\0' so the string "hello" == the array of characters {'h', 'e', 'l', 'l', 'o', '\0'}

0

What does '\0' means?

0

https://en.m.wikipedia.org/wiki/Null_character