init
This commit is contained in:
21
C/c03v2/ex01/ft_strncmp.c
Normal file
21
C/c03v2/ex01/ft_strncmp.c
Normal file
@ -0,0 +1,21 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_strncmp.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/07/18 13:17:50 by cchauvet #+# #+# */
|
||||
/* Updated: 2022/07/24 17:41:37 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
int ft_strncmp(char *s1, char *s2, unsigned int n)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
i = 0;
|
||||
while (s1[i] != 0 && s2[i] != 0 && s1[i] == s2[i] && i < n - 1)
|
||||
i++;
|
||||
return (s1[i] - s2[i]);
|
||||
}
|
Reference in New Issue
Block a user