tgrekov-philosophers
HIVE philosophers July 2024
Loading...
Searching...
No Matches
len.c
1
/* ************************************************************************** */
2
/* */
3
/* ::: :::::::: */
4
/* len.c :+: :+: :+: */
5
/* +:+ +:+ +:+ */
6
/* By: tgrekov <tgrekov@student.hive.fi> +#+ +:+ +#+ */
7
/* +#+#+#+#+#+ +#+ */
8
/* Created: 2024/07/27 05:30:32 by tgrekov #+# #+# */
9
/* Updated: 2024/07/27 07:50:46 by tgrekov ### ########.fr */
10
/* */
11
/* ************************************************************************** */
12
13
int
ft_strlen(
char
*str)
14
{
15
int
i;
16
17
i = 0;
18
while
(*str++)
19
i++;
20
return
(i);
21
}
22
23
int
intlen(
int
n)
24
{
25
int
i;
26
27
i = 0;
28
if
(!n)
29
return
(1);
30
while
(n)
31
{
32
n /= 10;
33
i++;
34
}
35
return
(i);
36
}
37
38
int
ullen(
unsigned
long
n)
39
{
40
int
i;
41
42
i = 0;
43
if
(!n)
44
return
(1);
45
while
(n)
46
{
47
n /= 10;
48
i++;
49
}
50
return
(i);
51
}
src
mandatory
utils
len.c