minishell
ft_strncmp.c File Reference
#include <stddef.h>
#include "ft_string.h"
Include dependency graph for ft_strncmp.c:

Go to the source code of this file.

Functions

int ft_strncmp (const char *s1, const char *s2, size_t n)
 

Function Documentation

◆ ft_strncmp()

int ft_strncmp ( const char *  s1,
const char *  s2,
size_t  n 
)

Definition at line 16 of file ft_strncmp.c.

17 {
18  if (n == 0)
19  return (0);
20  while (--n > 0 && *s1 == *s2 && *s1 != '\0')
21  {
22  s1++;
23  s2++;
24  }
25  return (*((unsigned char *)s1) - *((unsigned char *)s2));
26 }
Here is the caller graph for this function: