42_minishell/libft/ft_strchr.c
2024-04-23 16:46:55 +02:00

29 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mcolonna <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/10/03 10:43:17 by mcolonna #+# #+# */
/* Updated: 2023/10/10 13:17:35 by mcolonna ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
char *ft_strchr(const char *s, int c)
{
int i;
i = 0;
while (s[i])
{
if (s[i] == c)
return ((char *)s + i);
i++;
}
if (s[i] == c)
return ((char *)s + i);
return (NULL);
}