At the risk of having this question voted as a duplicate, or even to have it closed, I had this question has come up.
Background
In \"normal
One (fairly common) way to do this, whether for big integer or normal integer types, is to repeatedly divide the number by 10, saving the remainder as the next digit (starting with the least significant). Keep going until the number reaches zero. Since the first digit found is the least significant, you may need to reverse the string at the end, or build it in reverse as you go.
An example using ordinary unsigned int might look like:
void printUInt(unsigned x) {
char buf[(sizeof(x) * CHAR_BIT) / 3 + 2]; // slightly oversize buffer
char *result = buf + sizeof(buf) - 1; // index of next output digit
// add digits to result, starting at
// the end (least significant digit)
*result = '\0'; // terminating null
do {
*--result = '0' + (x % 10); // remainder gives the next digit
x /= 10;
} while (x); // keep going until x reaches zero
puts(result);
}
The process is pretty much the same for a big integer -- though it would be best to do the division and find the remainder in one step if you can.
The above example builds the string from the end of the buffer (so result ends up pointing in the middle of the buffer somewhere), but you could also build it from the start and reverse it afterward.
You can estimate the size needed for the output if you can determine the number of bits used in your original number (about 1 additional digit per 3 bits -- slightly less).