42_C_PISCINE/C/c03/ex01/ft_strncmp.c
Camille Chauvet 29ed24d567 init
2023-05-17 16:45:25 +00:00

22 lines
1.0 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/18 13:17:50 by cchauvet #+# #+# */
/* Updated: 2022/07/21 12:57:14 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
int ft_strncmp(char *s1, char *s2, unsigned int n)
{
int i;
i = 0;
while (s1[i] != 0 && s2[i] != 0 && s1[i] == s2[i] && i < n - 1)
i++;
return (s1[i] - s2[i]);
}