-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_memcmp.c
29 lines (26 loc) · 1.22 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
/* ************************************************************************** */
/* LE - / */
/* / */
/* ft_memcmp.c .:: .:/ . .:: */
/* +:+:+ +: +: +:+:+ */
/* By: cgarrot <marvin@le-101.fr> +:+ +: +: +:+ */
/* #+# #+ #+ #+# */
/* Created: 2018/10/06 10:07:23 by cgarrot #+# ## ## #+# */
/* Updated: 2018/10/10 18:23:05 by cgarrot ### #+. /#+ ###.fr */
/* / */
/* / */
/* ************************************************************************** */
#include "libft.h"
int ft_memcmp(const void *s1, const void *s2, size_t n)
{
unsigned int i;
const unsigned char *s3;
const unsigned char *s4;
i = -1;
s3 = s1;
s4 = s2;
while (++i < n)
if (s3[i] < s4[i] || s3[i] > s4[i])
return (s3[i] - s4[i]);
return (0);
}