/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_memcmp.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: dgaillet +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/11/05 18:00:38 by dgaillet #+# #+# */ /* Updated: 2025/11/11 11:59:58 by dgaillet ### ########lyon.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 (1); if (((unsigned char *) s1)[i] < ((unsigned char *) s2)[i]) return (-1); i++; } return (0); }