31 lines
1 KiB
C
31 lines
1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_get_size.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2022/10/10 22:50:35 by erey-bet #+# #+# */
|
|
/* Updated: 2022/10/11 22:14:29 by erey-bet ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "ft_printf.h"
|
|
|
|
int ft_get_size(long long n)
|
|
{
|
|
long i;
|
|
|
|
if (n == 0)
|
|
return (1);
|
|
i = 0;
|
|
if (n < 0)
|
|
n = n * -1;
|
|
while (n > 0)
|
|
{
|
|
i++;
|
|
n = n / 10;
|
|
}
|
|
return (i);
|
|
}
|