/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strncmp.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/10/07 10:27:34 by cacharle #+# #+# */ /* Updated: 2019/10/21 11:04:38 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ #include int ft_strncmp(const char *s1, const char *s2, size_t n) { size_t i; i = 0; while (i < n && s1[i] == s2[i] && s1[i] && s2[i]) i++; if (i == n) i--; return (((unsigned char*)s1)[i] - ((unsigned char*)s2)[i]); }