From f6c6091bebb5e8aa1eb4856d2c6af7d13f2635e4 Mon Sep 17 00:00:00 2001 From: starnakin Date: Fri, 6 Sep 2024 23:08:37 +0200 Subject: [PATCH] add: strchr --- src/string/strchr.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/string/strchr.c diff --git a/src/string/strchr.c b/src/string/strchr.c new file mode 100644 index 0000000..e06e9f1 --- /dev/null +++ b/src/string/strchr.c @@ -0,0 +1,14 @@ + + +char *strchr(const char *str, int c) +{ + const char *start = str; + + while (*start) + { + if (*start == c) + return start; + start++; + } + return NULL; +}