/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strncmp.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: gtertysh +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/01 14:33:11 by gtertysh #+# #+# */ /* Updated: 2016/12/06 14:23:45 by gtertysh ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" int ft_strncmp(const char *s1, const char *s2, size_t n) { size_t i; i = 0; while (i < n && (*s1 || *s2)) { if (*(unsigned char *)s1 != *(unsigned char *)s2) return (*(unsigned char *)s1 - *(unsigned char *)s2); s1++; s2++; i++; } return (0); }