mirror of
https://github.com/guezoloic/libft.git
synced 2026-01-25 01:34:15 +00:00
feat: add ft_strchr function
This commit is contained in:
3
Makefile
3
Makefile
@@ -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
15
ft_strchr.c
Normal 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);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user