42-archive/libftasm/src/str/ft_strcmp.c

23 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/08/07 10:49:02 by jhalford #+# #+# */
/* Updated: 2016/11/03 16:08:51 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_strcmp(const char *s1, const char *s2)
{
int i;
i = 0;
while (*(s1 + i) && *(s1 + i) == *(s2 + i))
i++;
return (*((unsigned char*)s1 + i) - *((unsigned char*)s2 + i));
}