diff options
Diffstat (limited to 'src/string/strlen.c')
| -rw-r--r-- | src/string/strlen.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/string/strlen.c b/src/string/strlen.c new file mode 100644 index 00000000..89ccbfcc --- /dev/null +++ b/src/string/strlen.c @@ -0,0 +1,25 @@ +#include <string.h> +#include "nonstd/assert.h" + +/** find string length **/ +size_t strlen(const char *s) +{ + size_t i = 0; + + ASSERT_NONNULL(s); + + for (i = 0; s[i] != '\0'; i++) { + continue; + } + + return i; +} + +/*** +counts the number of bytes in the string ARGUMENT(s), not +including the terminating null character. +***/ +/* + RETURN_ALWAYS(the length of the string); +STDC(1) +*/ |
