-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_nbrlen.c
30 lines (27 loc) · 1.04 KB
/
ft_nbrlen.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_nbrlen.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mfebvay <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2013/12/13 17:42:27 by mfebvay #+# #+# */
/* Updated: 2014/03/15 18:37:24 by mfebvay ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
size_t ft_nbrlen(int n)
{
size_t len;
len = 0;
if (n == 0)
return (1);
if (n < 0)
len++;
while (n)
{
len++;
n /= 10;
}
return (len);
}