Files
libft/ft_memcmp.c
Angel Ortigosa Perez c87ab67280 Libft aortigos
2025-11-15 09:18:35 +01:00

30 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memcmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aortigos <aortigos@student.42malaga.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/09/22 19:17:43 by aortigos #+# #+# */
/* Updated: 2023/09/22 19:21:07 by aortigos ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_memcmp(const void *s1, const void *s2, size_t n)
{
unsigned int 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);
}