26 lines
1.1 KiB
C
26 lines
1.1 KiB
C
|
/* ************************************************************************** */
|
||
|
/* */
|
||
|
/* ::: :::::::: */
|
||
|
/* 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);
|
||
|
}
|