-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_intlen.c
30 lines (27 loc) · 1.04 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_intlen.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jfreitas <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/08/14 17:03:05 by jfreitas #+# #+# */
/* Updated: 2019/12/23 17:43:58 by jfreitas ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_intlen(int n)
{
size_t len;
len = 0;
if (n == 0)
return (1);
if (n < 0)
len++;
while (n)
{
n = n / 10;
len++;
}
return (len);
}