31 lines
1.1 KiB
C
31 lines
1.1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_strcmp.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2016/08/07 10:49:02 by jhalford #+# #+# */
|
|
/* Updated: 2016/08/25 17:06:34 by jhalford ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "libft.h"
|
|
|
|
int ft_strcmp(const char *s1, const char *s2)
|
|
{
|
|
int cmp;
|
|
int i;
|
|
|
|
i = 0;
|
|
while (1)
|
|
{
|
|
cmp = (s1[i] - s2[i]);
|
|
if (s1[i] == '\0' && s2[i] == '\0')
|
|
return (cmp);
|
|
if (s1[i] == s2[i])
|
|
i++;
|
|
else
|
|
return (cmp);
|
|
}
|
|
}
|