fix(ft_memcmp): update int to size_t and comply to 42 norm

This commit is contained in:
2025-10-22 19:02:48 +02:00
parent e68ecb0993
commit c07b2f4347

View File

@@ -1,16 +1,18 @@
#include "libft.h" #include "libft.h"
#include <stddef.h>
int ft_memcmp(const void *s1, const void *s2, size_t n) int ft_memcmp(const void *s1, const void *s2, size_t n)
{ {
char *c1; char *c1;
char *c2; char *c2;
int i; size_t i;
c1 = (char *)s1; c1 = (char *)s1;
c2 = (char *)s2; c2 = (char *)s2;
i = 0; i = 0;
while (i < n && c1[i] == c2[i]) while (i < n && c1[i] == c2[i])
i++; i++;
if (i == n) return (0); if (i == n)
return (0);
return (c1[i] - c2[i]); return (c1[i] - c2[i]);
} }