1
0
cub3d/libft/str/ft_strchr.c

32 lines
1.1 KiB
C
Raw Normal View History

2024-09-10 16:27:06 +02:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: madumerg <madumerg@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/10/30 16:16:43 by madumerg #+# #+# */
/* Updated: 2023/11/07 17:50:18 by madumerg ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strchr(const char *str, int p)
{
int i;
i = 0;
if (!str)
return (NULL);
while (str[i] != '\0')
{
if (str[i] == (unsigned char)p)
return ((char *) &str[i]);
i++;
}
if (str[i] == (unsigned char)p)
return ((char *) &str[i]);
return (0);
}