You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
1.1 KiB
29 lines
1.1 KiB
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_memcmp.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: narnaud <narnaud@student.42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2021/10/22 15:16:23 by narnaud #+# #+# */
|
|
/* Updated: 2022/03/24 09:22:49 by narnaud ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "../libft.h"
|
|
|
|
int ft_memcmp(const void *s1, const void *s2, size_t n)
|
|
{
|
|
size_t i;
|
|
int diff;
|
|
|
|
i = 0;
|
|
while (i < n)
|
|
{
|
|
diff = *(unsigned char *)(s1 + i) - *(unsigned char *)(s2 + i);
|
|
if (diff)
|
|
return (diff);
|
|
i++;
|
|
}
|
|
return (0);
|
|
}
|
|
|