-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strcmp.c
executable file
·23 lines (21 loc) · 1.05 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tseguier <tseguier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2013/11/22 04:12:18 by tseguier #+# #+# */
/* Updated: 2014/07/06 14:09:18 by tseguier ### ########.fr */
/* */
/* ************************************************************************** */
int ft_strcmp(const char *s1, const char *s2)
{
int i;
i = 0;
if (!s1 || !s2)
return (-1);
while (*(s1 + i) != *(s2 + i) && *(s1 + i))
++i;
return ((int)(*s1 - *s2));
}