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?

23rd Feb 2021, 3:01 PM
Radib 77
Radib 77 - avatar
3 Answers
+ 1
Because every string has the end character: '\0' so the string "hello" == the array of characters {'h', 'e', 'l', 'l', 'o', '\0'}
23rd Feb 2021, 3:08 PM
Slick
Slick - avatar
0
What does '\0' means?
23rd Feb 2021, 3:40 PM
Radib 77
Radib 77 - avatar