libft/ft_nbrlen.c
Tanguy MAZE f88ff8a600 Added:
- function for deleting word tables
	- function for putting on scrren x chars of char*
	- function for getting number of chars in int
2018-07-25 18:49:06 +02:00

31 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_nbrlen.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/07/25 17:45:29 by tmaze #+# #+# */
/* Updated: 2018/07/25 18:20:22 by tmaze ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_nbrlen(int nb)
{
size_t nb_len;
nb_len = 0;
if (nb <= 0)
nb_len++;
if (nb < 0)
nb *= -1;
while (nb > 0)
{
nb /= 10;
nb_len++;
}
return (nb_len);
}