/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strncmp.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: thrieg +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/10/14 17:12:52 by thrieg #+# #+# */ /* Updated: 2025/02/16 19:04:55 by thrieg ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" int ft_strncmp(const char *s1, const char *s2, size_t n) { while (n && *s1 && (*s1 == *s2)) { s1++; s2++; n--; } if (n == 0) return (0); return ((const unsigned char)*s1 - (const unsigned char)*s2); }