42_cub3d/Libft/ft_strchr.c
2024-10-09 03:35:09 +02:00

28 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: grobledo <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/04 12:59:29 by grobledo #+# #+# */
/* Updated: 2023/02/04 12:59:31 by grobledo ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strchr(const char *str, int tofind)
{
int i;
i = 0;
while (str[i])
{
if ((unsigned char)str[i] == (unsigned char)tofind)
return ((char *)&str[i]);
i++;
}
if (tofind == '\0')
return ((char *)&str[i]);
return (0);
}