base c lib without external lib
This commit is contained in:
20
ft_strchr.c
Normal file
20
ft_strchr.c
Normal file
@@ -0,0 +1,20 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_strchr.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: dgaillet <dgaillet@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/11/05 17:24:37 by dgaillet #+# #+# */
|
||||
/* Updated: 2025/11/05 17:38:39 by dgaillet ### ########lyon.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
char *ft_strchr(const char *s, int c)
|
||||
{
|
||||
if (*s == c)
|
||||
return ((char *) s);
|
||||
if (!(*s))
|
||||
return (0);
|
||||
return (ft_strchr(s + 1, c));
|
||||
}
|
||||
Reference in New Issue
Block a user