Here's how this works:
I want to convert a number to a string.
I want to convert a number to a string and concatenate it to another string.
What do I need to know?
a) How to convert a number to a string.
b) How to concatenate two strings.
What do I know?
a) How to convert a number to a string.
What do I need to know?
a) How to concatenate two strings.

Once you know these two things, the job can be done. First pass, you'll probably make two strings, convert two numbers, and concatenate the second string to the first. Second pass, you'll look at your code and ask yourself how to simplify it. When you realize that a pointer to a string is simply a pointer to the first element of the string, and that a pointer can point at any element, thanks to pointer arithmetic, then you're home free.

Notice that I don't need int y if I'm willing to lose int x. I can simply replace int x with the new value at the appropriate point in the process. Further, I don't need either int if I can get away with putting the literal value directly in the sprintf statement. What you will need is knowledge of your circumstances, which will vary from case to case. This is part of the design phase, which always comes before you sit down at the keyboard.
Code:
#include <stdio.h>

int main (void)
{
	int x = 123;
	int y = 456;
	char theCombo [256];
	sprintf (theCombo,"%d", x);
	printf ("First step: %s\n", theCombo);
	sprintf (theCombo + strlen (theCombo), "%d", y);
	printf ("Second step: %s\n", theCombo);
	return 0;
}
Quote:
Originally Posted by Output
First step: 123
Second step: 123456