From 5b653ccffdc33c8774697a93cad0b499b88dca71 Mon Sep 17 00:00:00 2001 From: Charles Date: Sun, 28 Jul 2019 21:12:28 +0200 Subject: std library function almost done, tested with libft-unit-tests --- ft_strchr.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 ft_strchr.c (limited to 'ft_strchr.c') diff --git a/ft_strchr.c b/ft_strchr.c new file mode 100644 index 0000000..67b969e --- /dev/null +++ b/ft_strchr.c @@ -0,0 +1,17 @@ +#include + +char *ft_strchr(const char *s, int c) +{ + char *cursor; + + cursor = (char*)s; + while (*cursor) + { + if (*cursor == (char)c) + return (cursor); + cursor++; + } + if (c == 0) + return (cursor); + return (NULL); +} -- cgit