-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_int_len.c
31 lines (28 loc) · 1.07 KB
/
ft_int_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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_int_len.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ibeliaie <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/05/30 14:05:09 by ibeliaie #+# #+# */
/* Updated: 2023/05/30 14:06:08 by ibeliaie ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
/* count length of integer */
int ft_int_len(int n)
{
int len;
len = 0;
if (n == 0)
return (1);
if (n < 0)
n = -n;
while (n != 0)
{
len++;
n /= 10;
}
return (len);
}