maxishell
Implementation of a shell for Linux-like systems
Loading...
Searching...
No Matches
ft_memcmp.c File Reference
#include "libft.h"
Include dependency graph for ft_memcmp.c:

Go to the source code of this file.

Functions

int ft_memcmp (const void *s1, const void *s2, size_t n)
 

Function Documentation

◆ ft_memcmp()

int ft_memcmp ( const void *  s1,
const void *  s2,
size_t  n 
)

Definition at line 23 of file ft_memcmp.c.

24{
25 const unsigned char *st1;
26 const unsigned char *st2;
27
28 st1 = s1;
29 st2 = s2;
30 while (n--)
31 {
32 if (*st1 != *st2)
33 return (*st1 - *st2);
34 st1++;
35 st2++;
36 }
37 return (0);
38}