basics · beginner · ~15 min
Walk a C string to its NUL terminator.
Implement size_t my_strlen(const char *s) returning the number of characters before the terminating NUL — without calling strlen.
#include <stddef.h>
size_t my_strlen(const char *s) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.