-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathft_strcmp.c
More file actions
25 lines (23 loc) · 1.17 KB
/
ft_strcmp.c
File metadata and controls
25 lines (23 loc) · 1.17 KB
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: mimeyer <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/05/19 11:54:26 by mimeyer #+# #+# */
/* Updated: 2019/05/24 10:36:41 by mimeyer ### ########.fr */
/* */
/* ************************************************************************** */
int ft_strcmp(const char *s1, const char *s2)
{
int i;
unsigned const char *str1;
unsigned const char *str2;
i = 0;
str1 = (unsigned const char *)s1;
str2 = (unsigned const char *)s2;
while (str1[i] == str2[i] && str1[i] != '\0' && str2[i] != '\0')
i++;
return (str1[i] - str2[i]);
}