Using sprintf for an array of ints

Hello,
I am trying to figure out the best way to place 50 (1 digit) ints into an array of 50 chars. The following works:

1
2
3
4
5

for(int i =0; i <=50; i ++)
{
    sprintf(&charArray[i], "%d", intArray[i]);
}


However, I would prefer not to use a for loop. I tried the following but it just give me a strange number

 
sprintf(&charArray[0], "%d", intArray);
Is there any reason why you don't want to use a loop?
Topic archived. No new replies allowed.