123456789101112131415161718192021222324252627 |
- /* ************************************************************************** */
- /* */
- /* ::: :::::::: */
- /* ft_strncmp.c :+: :+: :+: */
- /* +:+ +:+ +:+ */
- /* By: mazimi <mazimi@student.42.fr> +#+ +:+ +#+ */
- /* +#+#+#+#+#+ +#+ */
- /* Created: 2014/11/25 14:13:10 by mazimi #+# #+# */
- /* Updated: 2014/12/02 16:05:23 by mazimi ### ########.fr */
- /* */
- /* ************************************************************************** */
- #include "libft.h"
- int ft_strncmp(const char *s1, const char *s2, size_t n)
- {
- unsigned char s11;
- unsigned char s22;
- s11 = *s1;
- s22 = *s2;
- if (!n || (!s11 && !s22))
- return (0);
- else if (s11 != s22)
- return (s11 - s22);
- return (ft_strncmp(++s1, ++s2, --n));
- }
|