feat: add ft_strchr function

This commit is contained in:
2025-10-08 10:24:57 +02:00
parent 9492262e6b
commit 1fd9f0c776
3 changed files with 20 additions and 0 deletions

View File

@@ -24,3 +24,6 @@ fclean: clean
rm -f $(LIB) rm -f $(LIB)
re: fclean $(LIB) re: fclean $(LIB)
norm: all
@act push --container-architecture linux/amd64

15
ft_strchr.c Normal file
View File

@@ -0,0 +1,15 @@
#include "libft.h"
char *ft_strchr(const char *s, int c)
{
size_t i;
i = 0;
while (i < ft_strlen(s))
{
if (s[i] == c)
return ((char *)s + i);
i++;
}
return (NULL);
}

View File

@@ -104,4 +104,6 @@ int ft_toupper(int c);
*/ */
int ft_tolower(int c); int ft_tolower(int c);
char *ft_strchr(const char *s, int c);
#endif #endif