Update Index.md (#24095)

added clarification: strlen() does not include the null-termination character
This commit is contained in:
yoadwo
2018-12-19 11:12:59 +02:00
committed by Manish Giri
parent 9a51e15850
commit 5606023aae

View File

@ -178,7 +178,8 @@ strncat(char s1[], char s2[], int n);
#### Get length: `strlen` #### Get length: `strlen`
`strlen` (from 'string length') will return an integer value corresponding to the length of the string. In this example, an integer called `string_length` will be assigned the length of `my_string`: `strlen` (from 'string length') will return an integer value corresponding to the length of the string. Even though all strings are terminated with a \0 character, it will not be included in the count (so the length "hello" is indeed 5 and not 6). In this example, an integer called `string_length` will be assigned the length of `my_string`:
```C ```C
string_length = strlen(my_string); string_length = strlen(my_string);
``` ```