26 lines
1.1 KiB
C
26 lines
1.1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_strncmp.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: adjoly <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2023/07/18 16:20:57 by adjoly #+# #+# */
|
|
/* Updated: 2023/07/25 13:07:01 by adjoly ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
int ft_strncmp(char *s1, char *s2, unsigned int n)
|
|
{
|
|
unsigned int i;
|
|
|
|
i = 0;
|
|
while ((s1[i] || s2[i]) && i < n)
|
|
{
|
|
if (s1[i] != s2[i])
|
|
return (s1[i] - s2[i]);
|
|
i++;
|
|
}
|
|
return (0);
|
|
}
|