int to char string

what is the most efficient way to put integer(long number) into the middle of the string(array of chars).

lets say we have int = 55555
& char string[10]

need to do it like this

string[10] = {0,0,0,5,5,5,5,5,0,0}

memcpy()

-br

lets say we have int = 55555

Lets first agree that that is impossible.

Are there things in the array that you don't want to overwrite?

sprintf will convert the int to an array of characters, of fixed (or variable) width. Then, you could use memcpy() or strcpy() to overwrite a portion of an array. Or you could do it all in one call to sprintf():

int num = 12345;
sprintf(string, "%c%c%c%05d", string[0], string[1], string[2], num);

There are ways to do this without copying the first three characters, but they require that I hook up an Arduino and test some code. I know that this works.

sprintf(&string[3], "%05d",num);