-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_memcmp.c
More file actions
25 lines (22 loc) · 1.11 KB
/
Copy pathft_memcmp.c
File metadata and controls
25 lines (22 loc) · 1.11 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memcmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cpoulain <cpoulain@student.42lehavre.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/16 13:55:28 by cpoulain #+# #+# */
/* Updated: 2024/10/16 15:32:55 by cpoulain ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_memcmp(const void *s1, const void *s2, size_t n)
{
size_t i;
i = 0;
if (!n)
return (0);
while (i + 1 < n && ((t_byte *)s1)[i] == ((t_byte *)s2)[i])
i++;
return (((t_byte *)s1)[i] - ((t_byte *)s2)[i]);
}