24 lines
1.1 KiB
C
24 lines
1.1 KiB
C
|
/* ************************************************************************** */
|
||
|
/* */
|
||
|
/* ::: :::::::: */
|
||
|
/* ft_strncmp.c :+: :+: :+: */
|
||
|
/* +:+ +:+ +:+ */
|
||
|
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||
|
/* +#+#+#+#+#+ +#+ */
|
||
|
/* Created: 2022/07/18 13:17:50 by cchauvet #+# #+# */
|
||
|
/* Updated: 2022/07/25 11:48:42 by cchauvet ### ########.fr */
|
||
|
/* */
|
||
|
/* ************************************************************************** */
|
||
|
|
||
|
int ft_strncmp(char *s1, char *s2, unsigned int n)
|
||
|
{
|
||
|
unsigned int i;
|
||
|
|
||
|
if (n == 0)
|
||
|
return (0);
|
||
|
i = 0;
|
||
|
while (s1[i] != 0 && s2[i] != 0 && s1[i] == s2[i] && i < n - 1)
|
||
|
i++;
|
||
|
return (s1[i] - s2[i]);
|
||
|
}
|