Please imagine size is a variable and could be also a long double with 2.000.000.
How to allocate the size of the char array more elegant? I think for allocating exactly what it needs I would need to know the length of variable size.Code:int size = 50; char size_as_chararray[8000]; sprintf(size_as_chararray, "%d", size);
I need something like
int size = 100.000
strlen(size) --> 6 (Numbers)
double size = 555555555
strlen(size) --> 9
Well, obviously I can't covert into char array first and use strlen then because converting into char array is the thing I originally wanted to do.
Is there some function to get the amount of numbers of a numeric type?