-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strcmp.c
executable file
·29 lines (25 loc) · 1.13 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mwilliam <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/04 09:23:06 by mwilliam #+# #+# */
/* Updated: 2016/11/14 08:54:56 by mwilliam ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/*
** Compares s1 and s2
*/
int ft_strcmp(const char *s1, const char *s2)
{
int index;
index = 0;
while (s1[index] && s2[index] && (s1[index] == s2[index]))
{
index++;
}
return ((unsigned char)s1[index] - (unsigned char)s2[index]);
}