/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_memcmp.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: grobledo +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/02/08 20:15:03 by grobledo #+# #+# */ /* Updated: 2023/02/08 20:15:05 by grobledo ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" int ft_memcmp(const void *s1, const void *s2, size_t n) { size_t i; i = 0; while (i < n) { if (((unsigned char *)s1)[i] != ((unsigned char *)s2)[i]) return (((unsigned char *)s1)[i] - ((unsigned char *)s2)[i]); i++; } return (0); }