-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_memcmp.c
30 lines (27 loc) · 1.13 KB
/
ft_memcmp.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memcmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ylagtab <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/03/30 15:57:05 by ylagtab #+# #+# */
/* Updated: 2020/02/27 22:58:33 by ylagtab ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_memcmp(const void *s1, const void *s2, size_t n)
{
unsigned char *a;
unsigned char *b;
a = (unsigned char *)s1;
b = (unsigned char *)s2;
while (n--)
{
if (*a != *b)
return (int)(*a - *b);
a++;
b++;
}
return (0);
}