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