/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_memcmp.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/11/08 12:04:48 by adjoly #+# #+# */ /* Updated: 2023/11/08 12:16:47 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" #include int ft_memcmp(const void *s1, const void *s2, size_t n) { size_t i; i = 0; while (((unsigned char *)s1)[i] == ((unsigned char *)s2)[i] && i < n - 1) i++; return (((unsigned char *)s1)[i] - ((unsigned char *)s2)[i]); }