-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_intlen.c
33 lines (30 loc) · 1.08 KB
/
ft_intlen.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_intlen.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: alalaoui <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/04/23 15:17:53 by alalaoui #+# #+# */
/* Updated: 2017/08/28 20:00:31 by alalaoui ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_intlen(long long int n)
{
int len;
if (n <= LONG_MIN)
return (20);
len = 0;
if (n <= 0)
{
len++;
n = -n;
}
while (n > 0)
{
n = n / 10;
len++;
}
return (len);
}