C в STR

char str[(int)((ceil(log10(num))+1)*sizeof(char))];
sprintf(str, "%d", 42);
Arrogant Angelfish