1
Files
Tom CHIVERT 1c9092caaf Norminette
2019-09-04 05:17:54 +02:00

26 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tchivert <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/04/04 18:03:22 by tchivert #+# #+# */
/* Updated: 2019/09/04 05:13:33 by tchivert ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_strncmp(const char *s1, const char *s2, size_t len)
{
unsigned int i;
i = 0;
if (len == 0)
return (0);
while ((i < len - 1) && s1[i] == s2[i] && s1[i] != '\0' && s2[i] != '\0')
i++;
return ((unsigned char)s1[i] - (unsigned char)s2[i]);
}