This commit is contained in:
rzy
2026-08-31 02:16:33 +02:00
commit 94cd5aac51
25 changed files with 705 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memcmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rzy <ry@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/08/23 23:24:25 by rzy #+# #+# */
/* Updated: 2026/08/23 23:26:32 by rzy ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_memcmp(const void *s1, const void *s2, size_t n)
{
unsigned char *s1_ptr;
unsigned char *s2_ptr;
size_t i;
s1_ptr = (unsigned char *)s1;
s2_ptr = (unsigned char *)s2;
i = 0;
while (i < n)
{
if (s1_ptr[i] != s2_ptr[i])
return (s1_ptr[i] - s2_ptr[i]);
++i;
}
return (0);
}