diff options
Diffstat (limited to 'lib/libc/string/strlen.c')
| -rw-r--r-- | lib/libc/string/strlen.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/libc/string/strlen.c b/lib/libc/string/strlen.c new file mode 100644 index 00000000..0eb222fa --- /dev/null +++ b/lib/libc/string/strlen.c @@ -0,0 +1,14 @@ +#include <stddef.h> + +size_t strlen(const char *str) +{ + size_t len = 0; + + if (str == NULL) + return 0; + + while (*str++) + len++; + + return len; +} |
