malloc/subprojects/libft/ft_strcmp.c

26 lines
1.1 KiB
C
Raw Permalink Normal View History

2019-04-24 20:59:37 +03:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gtertysh <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/01 13:40:16 by gtertysh #+# #+# */
/* Updated: 2016/12/06 19:52:50 by gtertysh ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_strcmp(const char *s1, const char *s2)
{
while (*s1 && *s2 && *(unsigned char *)s1 == *(unsigned char *)s2)
{
s1++;
s2++;
}
if (*(unsigned char *)s1 != *(unsigned char *)s2)
return (*(unsigned char *)s1 - *(unsigned char *)s2);
return (0);
}