-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstrings.c
42 lines (37 loc) · 1.19 KB
/
strings.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
33
34
35
36
37
38
39
40
41
42
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* strings.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rtavabil <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/02/22 13:37:23 by rtavabil #+# #+# */
/* Updated: 2024/02/22 16:50:50 by rtavabil ### ########.fr */
/* */
/* ************************************************************************** */
#include "philosophers.h"
int ft_strncmp(char *s1, char *s2, int n)
{
int i;
i = 0;
while ((s1[i] || s2[i]) && (i < n))
{
if (s1[i] < s2[i])
return (-1);
if (s2[i] < s1[i])
return (1);
i++;
}
return (0);
}
int ft_strlen(char *str)
{
int len;
len = 0;
while (*str)
{
str++;
len++;
}
return (len);
}