28 lines
1.1 KiB
C
28 lines
1.1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_strncmp.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: dgloriod <marvin@42lausanne.ch> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2021/08/09 11:32:49 by dgloriod #+# #+# */
|
|
/* Updated: 2021/08/18 11:44:44 by gbaconni ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
int ft_strncmp(char *s1, char *s2, unsigned int n)
|
|
{
|
|
unsigned int i;
|
|
|
|
i = 0;
|
|
while (i < n)
|
|
{
|
|
if (s1[i] > s2[i])
|
|
return (1);
|
|
else if (s1[i] < s2[i])
|
|
return (-1);
|
|
i++;
|
|
}
|
|
return (0);
|
|
}
|