/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_memchr.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: aortigos +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/09/22 19:00:54 by aortigos #+# #+# */ /* Updated: 2023/10/26 07:41:42 by aortigos ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" void *ft_memchr(const void *s, int c, size_t n) { size_t i; i = 0; while (i < n) { if (((const unsigned char *)s)[i] == (unsigned char)c) { return ((void *)&((const unsigned char *)s)[i]); } i++; } return (NULL); }