From e0eb95588f7d37ca7fb17a6734dc67c8599c190a Mon Sep 17 00:00:00 2001 From: starnakin Date: Fri, 6 Sep 2024 23:08:29 +0200 Subject: [PATCH] add: strlen --- src/string/strlen.c | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/string/strlen.c diff --git a/src/string/strlen.c b/src/string/strlen.c new file mode 100644 index 0000000..5cad17d --- /dev/null +++ b/src/string/strlen.c @@ -0,0 +1,10 @@ +#include + +size_t strlen(const char *str) +{ + const char *start = str; + + while (*start != '\0') + start++; + return start - str; +}