Convert an Int to a Char array

I need a way to Convert an Int to a Char array.
Srry, you must have read my question wrong :P.
Unions are completely unrelated to my question.

I need a function that can take all the digits from an integer and plug them into an array of characters.

Example:
The 2 in
int Number = 246
would be plugged into address 0 of the char* array.
The 4 would be placed into address 1 and so on.
A string being an array of chars, you could use this:
http://www.cplusplus.com/reference/clibrary/cstdlib/itoa/
You could do it the lazy way,
1
2
3
4
char letter = "0"
for(int x = 0; x < num; x++)
  letter++
letterArray[pos] = letter;


or the slightly more complicated, but very similar

http://www.cplusplus.com/forum/beginner/59154/

I have tried this, but it will only put it into a string. You will still have to use the above method if you want to use an actual array.
Topic archived. No new replies allowed.