/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_memcmp.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: vvobis +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/04/03 15:27:15 by vvobis #+# #+# */ /* Updated: 2024/04/09 19:21:02 by vvobis ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" int ft_memcmp(void *s1, void const *s2, size_t n) { unsigned char *p1; unsigned char *p2; unsigned int i; p1 = (unsigned char *)s1; p2 = (unsigned char *)s2; i = 0; while (i < n) { if (p1[i] != p2[i]) return (p1[i] - p2[i]); i++; } return (0); }