mirror of
https://github.com/Ladebeze66/libft.git
synced 2025-12-13 04:36:55 +01:00
28 lines
1.1 KiB
C
Executable File
28 lines
1.1 KiB
C
Executable File
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_memcmp.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2023/02/10 14:45:56 by fgras-ca #+# #+# */
|
|
/* Updated: 2023/11/14 17:18:05 by fgras-ca ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "libft.h"
|
|
|
|
int ft_memcmp(const void *s1, const void *s2, size_t n)
|
|
{
|
|
size_t i;
|
|
|
|
i = 0;
|
|
while (i < n)
|
|
{
|
|
if (((unsigned char *)s1)[i] != ((unsigned char *)s2)[i])
|
|
return (((unsigned char *)s1)[i] - ((unsigned char *)s2)[i]);
|
|
i++;
|
|
}
|
|
return (0);
|
|
}
|