-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_memcmp.c
More file actions
executable file
·29 lines (26 loc) · 1.19 KB
/
Copy pathft_memcmp.c
File metadata and controls
executable file
·29 lines (26 loc) · 1.19 KB
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memcmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: patrisor <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/02/25 21:04:57 by patrisor #+# #+# */
/* Updated: 2019/03/09 16:36:25 by patrisor ### ########.fr */
/* */
/* ************************************************************************** */
#include "includes/libft.h"
int ft_memcmp(const void *s1, const void *s2, size_t n)
{
unsigned char *s1c;
unsigned char *s2c;
size_t i;
i = -1;
s1c = (unsigned char *)s1;
s2c = (unsigned char *)s2;
while (++i < n && *(s1c + i) == *(s2c + i))
;
if (i == n)
return (0);
return (*(s1c + i) - *(s2c + i));
}