C/C++ Arena

Step 3 of 6

Write your own strlen

Knowing how the library works makes you dangerous (in a good way). A string's length is the number of chars before '\0'.

Your turn: write int my_strlen(const char s[]) without using <string.h>.

const here promises the function won't modify the string.

Previous: strlen and friends Next: Compare strings correctly