26 lines
1.1 KiB
C
26 lines
1.1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_strncmp.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: gtertysh <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2016/11/01 12:04:56 by gtertysh #+# #+# */
|
|
/* Updated: 2016/11/01 12:05:00 by gtertysh ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
int ft_strncmp(char *s1, char *s2, unsigned int n)
|
|
{
|
|
while (*s1 && *s1 == *s2 && n > 0)
|
|
{
|
|
s1++;
|
|
s2++;
|
|
n--;
|
|
}
|
|
if (n == 0)
|
|
return (0);
|
|
else
|
|
return (*s1 - *s2);
|
|
return (0);
|
|
}
|