malloc/lib/libft/ft_num_len.c
2019-04-24 20:59:37 +03:00

28 lines
1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_num_len.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gtertysh <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/04/02 06:46:38 by gtertysh #+# #+# */
/* Updated: 2017/04/02 06:46:41 by gtertysh ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_num_len(long num)
{
int len;
len = 1;
if (num > 9)
while (num)
{
num /= 10;
if (num)
len++;
}
return (len);
}