-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_memcmp.c
27 lines (24 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memcmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gantonio <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/05/18 17:52:27 by gantonio #+# #+# */
/* Updated: 2021/05/31 19:28:42 by gantonio ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_memcmp(const void *str1, const void *str2, size_t len)
{
size_t i;
i = 0;
while (i < len)
{
if (((unsigned char *)str1)[i] != ((unsigned char *)str2)[i])
return (((unsigned char *)str1)[i] - ((unsigned char *)str2)[i]);
i++;
}
return (0);
}