/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_memcmp.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: apommier +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/11/29 00:11:51 by apommier #+# #+# */ /* Updated: 2022/01/17 11:30:32 by apommier ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" int ft_memcmp(const void *s1, const void *s2, size_t n) { int i; i = 0; while (n) { if (((unsigned char *)s1)[i] != ((unsigned char *)s2)[i]) return (((unsigned char *)s1)[i] - ((unsigned char *)s2)[i]); n--; i++; } return (0); }