From 1fd9f0c776d7baa4b1c552de918cf75b1677e2a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20GUEZO?= Date: Wed, 8 Oct 2025 10:24:57 +0200 Subject: [PATCH] feat: add ft_strchr function --- Makefile | 3 +++ ft_strchr.c | 15 +++++++++++++++ libft.h | 2 ++ 3 files changed, 20 insertions(+) create mode 100644 ft_strchr.c diff --git a/Makefile b/Makefile index ae6b27f..6041d4b 100644 --- a/Makefile +++ b/Makefile @@ -24,3 +24,6 @@ fclean: clean rm -f $(LIB) re: fclean $(LIB) + +norm: all + @act push --container-architecture linux/amd64 diff --git a/ft_strchr.c b/ft_strchr.c new file mode 100644 index 0000000..e56b115 --- /dev/null +++ b/ft_strchr.c @@ -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); +} diff --git a/libft.h b/libft.h index ecb2e0b..68fe8ac 100644 --- a/libft.h +++ b/libft.h @@ -104,4 +104,6 @@ int ft_toupper(int c); */ int ft_tolower(int c); +char *ft_strchr(const char *s, int c); + #endif