diff --git a/ex01/ft_strncmp.c b/ex01/ft_strncmp.c index b2281a6..afa4834 100644 --- a/ex01/ft_strncmp.c +++ b/ex01/ft_strncmp.c @@ -6,12 +6,14 @@ /* By: tischmid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/03/24 02:01:33 by tischmid #+# #+# */ -/* Updated: 2023/03/28 05:02:15 by tischmid ### ########.fr */ +/* Updated: 2023/03/28 18:54:54 by tischmid ### ########.fr */ /* */ /* ************************************************************************** */ int ft_strncmp(char *s1, char *s2, unsigned int n) { + if (!n) + return (1); while (*s1 && *s2 && *s1 == *s2 && --n) { ++s1; @@ -24,7 +26,7 @@ int ft_strncmp(char *s1, char *s2, unsigned int n) #include #define STR1 "abd" #define STR2 "abc" -#define LENGTH 3 +#define LENGTH 0 int main(void) {