feat: add ft_strlen function

This commit is contained in:
2025-09-29 20:35:58 +02:00
parent d3b4c38ff4
commit 421a91d4de
2 changed files with 20 additions and 1 deletions

11
ft_strlen.c Normal file
View File

@@ -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);
}

View File

@@ -1,6 +1,8 @@
#ifndef LIBFT_A #ifndef LIBFT_A
#define LIBFT_A #define LIBFT_A
# include <stdlib.h>
/* /*
The ft_isalpha() function tests for The ft_isalpha() function tests for
any character for which isupper(3) or any character for which isupper(3) or
@@ -39,4 +41,10 @@ int ft_isascii(int c);
*/ */
int ft_isprint(int c); int ft_isprint(int c);
/*
The strlen() function computes the
length of the string s.
*/
size_t strlen(const char *s);
#endif #endif