When INT_MAX is 2^31 (2,147,483,648), which it is on most modern computers (with 32-bit integers), the maximum number of digits for a number would be 10, not 9. On older machines with 16-bit numbers, INT_MAX would be 2^15 (32,768), which is 5 digits.
[edit=2] For 64-bit integers, which you probably won't get with an int but might with a long, the maximum value would be 2^63 = 9223372036854775808L
(9,223,372,036,854,775,808) -- 19 digits; see below. [/edit]
INT_MAX is a real constant, declared in <limits.h> (or <climits> for C++). You could could the number of digits in that value if you wanted to be really portable.
I've seen
software that uses 19 for INT_DIGITS:
Code:
#define INT_DIGITS 19 /* enough for 64-bit integer */
This is the C++ programming forum. So are you using C or C++? Because in C I might mention realloc(), but in C++ . . .