- The documentation on the header allow u to see on the files where the header is inclued
31 lines
1.2 KiB
C
31 lines
1.2 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_memcmp.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: rparodi <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2023/11/07 16:49:04 by rparodi #+# #+# */
|
|
/* Updated: 2025/09/05 16:26:04 by rparodi ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include <unistd.h>
|
|
|
|
int ft_memcmp(const void *s1, const void *s2, size_t n)
|
|
{
|
|
size_t i;
|
|
unsigned char *str1;
|
|
unsigned char *str2;
|
|
|
|
i = 0;
|
|
str1 = (unsigned char *)s1;
|
|
str2 = (unsigned char *)s2;
|
|
while (i < n)
|
|
{
|
|
if (str1[i] != str2[i])
|
|
return (str1[i] - str2[i]);
|
|
i++;
|
|
}
|
|
return (0);
|
|
}
|