-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_memcmp.c
More file actions
25 lines (23 loc) · 1.13 KB
/
ft_memcmp.c
File metadata and controls
25 lines (23 loc) · 1.13 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: cde-la-r <cde-la-r@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/08/10 18:58:58 by cde-la-r #+# #+# */
/* Updated: 2023/08/16 18:50:58 by cde-la-r ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_memcmp(const void *s1, const void *s2, size_t n)
{
while (n--)
{
if (*(const unsigned char *)s1 != *(const unsigned char *)s2)
return (*(const unsigned char *)s1 - *(const unsigned char *)s2);
s1++;
s2++;
}
return (0);
}