You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: frdescam <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/06/06 19:43:53 by frdescam #+# #+# */
/* Updated: 2019/06/10 23:53:18 by frdescam ### ########.fr */
/* */
/* ************************************************************************** */
int ft_strcmp(char *s1, char *s2)
{
int i;
i = 0;
while (s1[i])
{
if (s1[i] != s2[i])
{
return (s1[i] - s2[i]);
}
i++;
}
if (s2[i] == '\0')
return (0);
else
return (-s2[i]);
}