get_next_line/ft_strncmp.c

22 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gbrochar <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/11/28 14:57:36 by gbrochar #+# #+# */
/* Updated: 2015/11/28 15:34:45 by gbrochar ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_strncmp(const char *s1, const char *s2, size_t n)
{
while ((*s1 || *s2) && n--)
if (*s1++ != *s2++)
return ((unsigned char)*--s1 - (unsigned char)*--s2);
return (0);
}