-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_len.c
43 lines (38 loc) · 1.17 KB
/
ft_len.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
43
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_len.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jgasparo <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/06/13 16:08:11 by jgasparo #+# #+# */
/* Updated: 2023/06/13 16:08:14 by jgasparo ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_strlen(const char *s)
{
int len;
len = 0;
while (s[len] != '\0')
len++;
return (len);
}
int ft_count(int n)
{
int count;
count = 0;
if (n == 0)
return (1);
if (n < 0)
{
n *= -1;
count++;
}
while (n != 0)
{
n /= 10;
count++;
}
return (count);
}