Hello all
I am studying for a C++ test, I have not been able to solve this:
I have data in a int* and I want to print it out to a char*
I thought I could do it the following way:
// pOutputString is of type char*
// pIntegers is of type int*
int pos = 0;
for (int i = 0; i< SIZE; i++)
{
pOutputString[pos] = char(pIntegers[i]);
pos++;
}
if I iterate over pOutputString with iostream, I should get the tring representation (so 11 will turn into "11").
As part of this homework, I'm not allowed to use any third-party libs. If I want something, I must do it myself.
Thanks.
Edit: You can see the entire code in IDEone: http://ideone.com/nKXpg