adding itoa_static and ft_nbrlen

This commit is contained in:
hugogogo
2026-05-07 03:06:16 +02:00
parent b768ac1a14
commit 36379f56b0
4 changed files with 102 additions and 0 deletions

16
srcs/ft_nbrlen.c Normal file
View File

@@ -0,0 +1,16 @@
#include "libft.h"
// return length of int
// eg. 123 -> 3, -123 -> 4
size_t ft_nbrlen(int nbr)
{
int len;
len = (nbr < 0) ? 2 : 1;
while (nbr /= 10)
len++;
return len;
}