mirror of
https://github.com/guezoloic/libft.git
synced 2026-01-25 00:34:15 +00:00
fix(ft_memcmp): update int to size_t and comply to 42 norm
This commit is contained in:
@@ -1,16 +1,18 @@
|
||||
#include "libft.h"
|
||||
#include <stddef.h>
|
||||
|
||||
int ft_memcmp(const void *s1, const void *s2, size_t n)
|
||||
{
|
||||
char *c1;
|
||||
char *c2;
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
c1 = (char *)s1;
|
||||
c2 = (char *)s2;
|
||||
i = 0;
|
||||
while (i < n && c1[i] == c2[i])
|
||||
i++;
|
||||
if (i == n) return (0);
|
||||
if (i == n)
|
||||
return (0);
|
||||
return (c1[i] - c2[i]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user