Files
mmoat/lib/libft/srcs/str/ft_strchr.c
gazhonsepaskwa 09c2cb5b3e base struct
2025-01-13 13:21:53 +01:00

32 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: nalebrun <nalebrun@student.s19.be> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/14 09:06:01 by nalebrun #+# #+# */
/* Updated: 2024/11/25 16:15:57 by nalebrun ### ########.fr */
/* */
/* ************************************************************************** */
#include "../../libft.h"
char *ft_strchr(const char *s, int c)
{
int i;
char ch;
ch = c;
i = 0;
if (ch == '\0')
return ((char *)&s[ft_strlen(s)]);
while (s[i] != 0)
{
if (s[i] == ch)
return ((char *)&s[i]);
i++;
}
return (NULL);
}