/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strncmp.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: whaffman +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/07/05 18:42:11 by whaffman #+# #+# */ /* Updated: 2024/07/10 14:51:24 by whaffman ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" int ft_strncmp(const char *s1, const char *s2, size_t n) { size_t i; i = 0; if (n == 0) return (0); while (*s1 && *s1 == *s2 && i < n - 1) { s1++; s2++; i++; } return ((unsigned char) *s1 - (unsigned char) *s2); }