Push the final version

This commit is contained in:
Raphaël 2024-04-20 14:48:16 +02:00
commit d0fe1fb2fb
28 changed files with 1459 additions and 0 deletions

31
libft/ft_strncmp.c Normal file
View file

@ -0,0 +1,31 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rparodi <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/07 16:56:56 by rparodi #+# #+# */
/* Updated: 2023/11/09 13:16:39 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_strncmp(const char *s1, const char *s2, size_t n)
{
size_t i;
int diff;
i = 0;
while ((s1[i] || s2[i]) && i < n)
{
if (s1[i] != s2[i])
{
diff = (unsigned char)s1[i] - (unsigned char)s2[i];
return (diff);
}
i++;
}
return (0);
}