-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strcmp.c
32 lines (29 loc) · 1.12 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: amait-ou <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/21 19:35:18 by amait-ou #+# #+# */
/* Updated: 2023/01/24 00:22:28 by amait-ou ### ########.fr */
/* */
/* ************************************************************************** */
#include "./superlib.h"
int ft_strcmp(char *s1, char *s2)
{
int i;
i = 0;
while (s1[i] && s2[i])
{
if (!(s1[i] == s2[i]))
return (s1[i] - s2[i]);
++i;
}
if (s1[i])
return (s1[i]);
else if (s2[i])
return (-s2[i]);
else
return (0);
}