Cub3D/libft/str/ft_strchr.c
2024-10-31 17:24:36 +01:00

29 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rparodi <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/07 16:32:19 by rparodi #+# #+# */
/* Updated: 2023/11/09 12:08:01 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strchr(const char *s, int c)
{
unsigned int i;
i = 0;
if (c == 0)
return ((char *)s + ft_strlen(s));
while (s[i] != '\0')
{
if (s[i] == (char)c)
return ((char *)s + i);
i++;
}
return (NULL);
}