sync
This commit is contained in:
27
C_Piscine_C_03/git/ex01/ft_strncmp.copy.c
Normal file
27
C_Piscine_C_03/git/ex01/ft_strncmp.copy.c
Normal file
@@ -0,0 +1,27 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* 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);
|
||||
}
|
||||
Reference in New Issue
Block a user