26 lines
1.1 KiB
C
26 lines
1.1 KiB
C
|
/* ************************************************************************** */
|
||
|
/* */
|
||
|
/* ::: :::::::: */
|
||
|
/* ft_memcmp.c :+: :+: :+: */
|
||
|
/* +:+ +:+ +:+ */
|
||
|
/* By: gtertysh <marvin@42.fr> +#+ +:+ +#+ */
|
||
|
/* +#+#+#+#+#+ +#+ */
|
||
|
/* Created: 2016/11/29 16:31:56 by gtertysh #+# #+# */
|
||
|
/* Updated: 2016/12/06 14:07:47 by gtertysh ### ########.fr */
|
||
|
/* */
|
||
|
/* ************************************************************************** */
|
||
|
|
||
|
#include "libft.h"
|
||
|
|
||
|
int ft_memcmp(const void *s1, const void *s2, size_t n)
|
||
|
{
|
||
|
while ((int)n--)
|
||
|
{
|
||
|
if ((*(unsigned char *)s1 != *(unsigned char *)s2))
|
||
|
return (*(unsigned char *)s1 - *(unsigned char *)s2);
|
||
|
s1++;
|
||
|
s2++;
|
||
|
}
|
||
|
return (0);
|
||
|
}
|