-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_intlen.c
35 lines (32 loc) · 1.09 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
34
35
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_intlen.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ybenchel <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/11/09 11:08:19 by ybenchel #+# #+# */
/* Updated: 2024/12/15 17:41:34 by ybenchel ### ########.fr */
/* */
/* ************************************************************************** */
#include "pipex.h"
int ft_intlen(int n)
{
int len;
len = 0;
if (n == 0)
return (1);
if (n == -2147483648)
return (11);
if (n < 0)
{
len++;
n = -n;
}
while (n > 0)
{
n /= 10;
len++;
}
return (len);
}