/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_memchr.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: pbonilla +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/10/29 12:11:59 by pbonilla #+# #+# */ /* Updated: 2020/11/20 23:33:24 by pbonilla ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" void *ft_memchr(const void *s, int c, size_t n) { unsigned char *buff; unsigned int i; buff = (unsigned char *)s; i = 0; while (i != n) { if (buff[i] == (unsigned char)c) return ((void *)&buff[i]); ++i; } return (NULL); }