aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_memcmp.c
blob: ce6cc7706d70129338ab5f527fdff1c900637e04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "libft.h"

int
ft_memcmp (const void *s1, const void *s2, size_t n)
{
  const unsigned char *p1;
  const unsigned char *p2;

  p1 = s1;
  p2 = s2;
  while (n--)
    {
      if (*p1 != *p2)
        return (*p1 - *p2);
      p1++;
      p2++;
    }
  return (0);
}