wip_parsing
This commit is contained in:
31
libft/mem/ft_memcmp.c
Normal file
31
libft/mem/ft_memcmp.c
Normal file
@ -0,0 +1,31 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_memcmp.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: madumerg <madumerg@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/10/31 14:42:37 by madumerg #+# #+# */
|
||||
/* Updated: 2023/11/02 14:11:43 by madumerg ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
int ft_memcmp(const void *s1, const void *s2, size_t n)
|
||||
{
|
||||
size_t i;
|
||||
unsigned char *ptr1;
|
||||
unsigned char *ptr2;
|
||||
|
||||
ptr1 = (unsigned char *) s1;
|
||||
ptr2 = (unsigned char *) s2;
|
||||
i = 0;
|
||||
while (i < n)
|
||||
{
|
||||
if (ptr1[i] != ptr2[i])
|
||||
return (ptr1[i] - ptr2[i]);
|
||||
i++;
|
||||
}
|
||||
return (0);
|
||||
}
|
Reference in New Issue
Block a user