Joining strings

How would you join strings and variables, then store it in a different variable? I'm thinking something like this, but it doesn't work:

char completestring[] = "Hello, "personsname", how are you?"

Can somebody help?

strcat() ;) Or you can use printf but that's a bit heavier.

  char str[40];
  char person[] = "you there";
  strcpy(str, "Hello, ");
  strcat(str, person);
  strcat(str, ", how are you?");

But what are you planning to do with it? If you just want to send that to something like serial, then just send each part. It's a wast of memory to concat it first

  char person[] = "you there";
  Serial.print("Hello, ");
  Serial.print(person);
  Serial.print(", how are you?");

Have a look at the various cstring functions

I think you need strcat()

However maybe there is no need to create a composite string. You can produce the same effect with a series of Serial.print() statements.

…R