Add all git folders
This commit is contained in:
31
C_Piscine_C_03/git/ex01/ft_strncmp.c
Normal file
31
C_Piscine_C_03/git/ex01/ft_strncmp.c
Normal file
@@ -0,0 +1,31 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_strncmp.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/08/12 15:16:07 by gbaconni #+# #+# */
|
||||
/* Updated: 2021/08/12 15:16:11 by gbaconni ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
int ft_strncmp(char *s1, char *s2, unsigned int n)
|
||||
{
|
||||
char c1;
|
||||
char c2;
|
||||
|
||||
if (n == 0)
|
||||
return (0);
|
||||
c1 = '\0';
|
||||
c2 = '\0';
|
||||
while (n > 0)
|
||||
{
|
||||
c1 = *s1++;
|
||||
c2 = *s2++;
|
||||
if (c1 == '\0' || c1 != c2)
|
||||
break ;
|
||||
n--;
|
||||
}
|
||||
return (c1 - c2);
|
||||
}
|
||||
Reference in New Issue
Block a user