/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strncmp.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/09/27 08:30:26 by cchauvet #+# #+# */ /* Updated: 2022/09/28 17:29:56 by cchauvet ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" int ft_strncmp(const char *s1, const char *s2, size_t n) { size_t i; if (n == 0) return (0); i = 0; while (s1[i] == s2[i] && i < n - 1 && s1[i] && s2[i]) i++; return ((unsigned char) s1[i] - (unsigned char) s2[i]); }