diff --git a/ft_strlen.c b/ft_strlen.c new file mode 100644 index 0000000..56496ac --- /dev/null +++ b/ft_strlen.c @@ -0,0 +1,11 @@ +#include "libft.h" + +size_t strlen(const char *s) +{ + size_t i; + + i = 0; + while (s[i] != '\0') + i++; + return (i); +} diff --git a/libft.h b/libft.h index f639c76..660a88b 100644 --- a/libft.h +++ b/libft.h @@ -1,6 +1,8 @@ #ifndef LIBFT_A #define LIBFT_A +# include + /* The ft_isalpha() function tests for any character for which isupper(3) or @@ -39,4 +41,10 @@ int ft_isascii(int c); */ int ft_isprint(int c); -#endif \ No newline at end of file +/* + The strlen() function computes the + length of the string s. +*/ +size_t strlen(const char *s); + +#endif