-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strcmp.c
28 lines (25 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cbarbier <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/07/12 12:31:51 by cbarbier #+# #+# */
/* Updated: 2016/11/04 13:38:28 by cbarbier ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_strcmp(const char *s1, const char *s2)
{
unsigned char *p1;
unsigned char *p2;
p1 = (unsigned char *)s1;
p2 = (unsigned char *)s2;
while (*p1 && *p2 && *p1 == *p2)
{
p1++;
p2++;
}
return ((*p1) - (*p2));
}