-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_len.c
39 lines (36 loc) · 1.12 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_len.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: okimdil <okimdil@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/11/19 19:34:06 by okimdil #+# #+# */
/* Updated: 2019/11/19 19:34:08 by okimdil ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_len(int a)
{
int i;
i = 0;
if (a == 0)
return (1);
if (a == -2147483648)
return (10);
if (a < 0)
{
a *= -1;
while (a > 0)
{
a /= 10;
i++;
}
}
while (a > 0)
{
a /= 10;
i++;
}
return (i);
}