-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strcmp.c
25 lines (23 loc) · 1.09 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ademenet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/11/24 17:56:19 by ademenet #+# #+# */
/* Updated: 2015/11/30 10:36:53 by ademenet ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_strcmp(const char *s1, const char *s2)
{
while ((unsigned char)*s1 == (unsigned char)*s2)
{
if (*s1 == '\0')
return (0);
s1++;
s2++;
}
return ((unsigned char)*s1 - (unsigned char)*s2);
}