unsigned char

I have two variables

unsigned char messageOut[13], messageTx[15];
messageOut is obtained from data received on the Serial port.
messageTx is to be messageOut with a prefix added of "MC"
How do I add the prefix "MC" to the from of messageOut to create messageTx?

strcat

There are many many ways of doing it. Multiple functions exist that will allow you to effectively join character arrays together, or you can opt to do it manually.

When you think that each of your "strings" is just an array of letters, with each letter taking up a slot in the array, it becomes simple enough to work out a way to do it manually.

You have two arrays, one with two characters more space than the other. Each element in the array is associated with a number. Assigning and accessing elements within the arrays is as simple as specifying the element with [ and ].

So your newly built string could be made by first assigning M and C to the first two slices, then copying the characters from the source array.

messageTxt[0]='M';
messageTxt[1]='C';
for(int i=0; i<13; i++)
  messageTxt[2+i] = messageOut[i];

Or you can use functions like sprintf, memcpy, strcat, etc.

For example with sprintf:

sprintf(messageTxt,"MC%s",messageOut);

Although that looks much simpler from a programmer's POV, the work done behind the scenes is considerably more than just copying the data from one array to another.

With strcat, for example, you are effectively doing the same as the manual loop:

strcat(messageTxt,"MC");
strcat(messageTxt+2,messageOut);

For pure blistering speed and memory efficiency, however, there are tricks you can use to get rid of the source string entirely.

I don't know how you are obtaining the content of your source string, but "messageTxt" is just an address pointer which points to the location in memory that the string starts at. You add a number to it and you point to a place partway through the string.

So, you can do something like:

messageTxt[0] = 'M';
messageTxt[1] = 'C';
getDataFromMySensor(messageTxt+2);

and you will have placed the data in the string after the MC prefix, all with no more work whatsoever.