-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_memcmp.c
28 lines (25 loc) · 1.15 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memcmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: msaliuta <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/10/27 18:47:31 by msaliuta #+# #+# */
/* Updated: 2018/11/01 17:19:01 by msaliuta ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_memcmp(const void *s1, const void *s2, size_t n)
{
unsigned char *s1c;
unsigned char *s2c;
size_t i;
s1c = (unsigned char*)s1;
s2c = (unsigned char*)s2;
i = -1;
while (++i < n)
if (s1c[i] != s2c[i])
return (s1c[i] - s2c[i]);
return (0);
}