On 16/05/2012 10:46, Dmitry Olshansky wrote: <snip>
Don't ever do that. I mean allocating memory in tight cycle. Instead use circular buffer. (just use the same array and wrap indexes)
<snip>
You might as well not use a string representation at all. At the beginning of the loop, calculate the number of digits in n, then pow10 = 10 ^^ (digits - 1). Then cycle with
n = n / 10 + (n % 10) * pow10; Stewart.