Edited to be used on other project

This commit is contained in:
Raphael 2024-10-31 17:23:25 +01:00
parent e1d33272f7
commit 707e9a4177
9 changed files with 260 additions and 6 deletions

31
str/ft_strcmp.c Normal file
View file

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