Does the '\0' at the end of the string also get included here?
c++, string, strlen
Solution
There is no 11th place, ie, yes, that is one less element to use.
Don't put a string longer than 9 chars in there. `Strlen()` does not include the null terminator.
Eg:
char s[]="hello";
`s` is an array of 6 chars, but the `strlen()` of `s` is 5.
Problem
If I declare a string with 10 elements like this: ``` char s[10]; ``` then does the '\0'at the end occupy the 10th place or the 11th? Basically my question is that do we get 1 element less in the string? And if I use the strlen() function to find this string's length, will the return value be inclusive of the null? I.e if the string is "boy", will the function give me 3 or 4?