Basic C++ question

I think snprintf() is really what you are after...

Lets consider types first, you know that the largest base-10 number you will ever see in a 8-bit number is 3 digits, so to concatenate 2 8-bit numbers you will need 7 bytes of buffer. With 16 bits, the largest base-10 number will be 5 digits, meaning you need 11 bytes. Remember you need to provide room for the terminating null '\0'.

const int bufsz(11);
char buf[bufsz];
int a(1234), b(567);
snprintf(buf, bufsz, "%i%i", a, b);

Now buf contains { '1', '2', '3', '4', '5', '6', '7', '\0', X, X, X }, where X is undefined, but who cares, it all fit...