-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_memcmp.c
executable file
·31 lines (28 loc) · 1.18 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
31
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memcmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jraymond <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/11/11 21:01:04 by jraymond #+# #+# */
/* Updated: 2017/11/16 16:22:22 by jraymond ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_memcmp(const void *s1, const void *s2, size_t n)
{
unsigned char *bis_s1;
unsigned char *bis_s2;
bis_s1 = (unsigned char*)s1;
bis_s2 = (unsigned char*)s2;
while (n != 0)
{
if (*bis_s1 != *bis_s2)
return (*bis_s1 - *bis_s2);
bis_s1++;
bis_s2++;
n--;
}
return (0);
}