-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathft_strcmp.c
32 lines (29 loc) · 1.17 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
32
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: vbrazas <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/10/24 18:38:47 by vbrazas #+# #+# */
/* Updated: 2017/11/12 18:24:23 by vbrazas ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_strcmp(const char *s1, const char *s2)
{
size_t i;
unsigned char *ss1;
unsigned char *ss2;
i = 0;
ss1 = (unsigned char *)s1;
ss2 = (unsigned char *)s2;
while (ss1[i] || ss2[i])
{
if (ss1[i] != ss2[i])
return (ss1[i] - ss2[i]);
else
i++;
}
return (0);
}