-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strcmp.c
28 lines (26 loc) · 1.28 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hlimouni <hlimouni@student.1337.ma> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/03/20 10:04:16 by hlimouni #+# #+# */
/* Updated: 2021/03/20 11:22:29 by hlimouni ### ########.fr */
/* */
/* ************************************************************************** */
int ft_strcmp_c(const char *s1, const char *s2)
{
if (*s1 != *s2 || *s1 == '\0' || *s2 == '\0')
return ((unsigned char)*s1 - (unsigned char)*s2);
return (ft_strcmp_c(s1 + 1, s2 + 1));
}
// int ft_strcmp(const char *s1, const char *s2)
// {
// while (*s1 && *s2 && *s1 == *s2)
// {
// (char *)s1++;
// (char *)s2++;
// }
// return ((unsigned char)*s1 - (unsigned char)*s2);
// }