-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strcmp.c
31 lines (29 loc) · 1.11 KB
/
ft_strcmp.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: luiroel <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/09 21:45:33 by luiroel #+# #+# */
/* Updated: 2020/02/26 21:17:43 by luiroel ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_strcmp(const char *s1, const char *s2)
{
if (!s1 && !s2)
{
return (0);
}
while (*s1)
{
if (*s1 != *s2)
{
break ;
}
s1++;
s2++;
}
return (*(const unsigned char *)s1 - *(const unsigned char *)s2);
}