-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_memcmp.c
More file actions
31 lines (28 loc) · 1.19 KB
/
ft_memcmp.c
File metadata and controls
31 lines (28 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
30
31
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memcmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maceccar <maceccar@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/10 15:40:56 by maceccar #+# #+# */
/* Updated: 2023/11/10 15:40:56 by maceccar ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_memcmp(const void *str1, const void *str2, size_t n)
{
const unsigned char *char_dest;
const unsigned char *char_src;
size_t i;
i = 0;
char_dest = str1;
char_src = str2;
while (i < n)
{
if ((char_dest[i] - char_src[i]) != 0)
return (char_dest[i] - char_src[i]);
i++;
}
return (0);
}