ANSI-C: maximum number of characters printing a decimal int
I'd like to know if it is an easy way of determining the maximum number of characters to print a decimal int.
I know contains definitions like INT_MAX that say the maximum value an int can assume, but it is not what I want.
I'd like to be able to do something like:
int get_int( void )
{
char draft[ MAX_CHAR_OF_A_DECIMAL_INT ];
fgets( draft, sizeof( draft ), stdin );
return strtol( draft, NULL, 10 );
}
But how to find the value of MAX_CHAR_OF_A_DECIMAL_INT in a portable and low overheaded way?
Thanks!