String assembly based on 4 chars

Hello! I have a kinda weird and hard to explain question.
I have 4 chars:
freq1, freq2, freq3, and freq4.
I also have a string:
finalfreq.
I want finalfreq to equal all those chars, assembled together. (NOT added together, ASSEMBLED together)

Example:

freq1 = 2, freq2 = 7, freq3 = T, and freq4 = K.
So, you put them together!
In this example, the string finalfreq = 27TK because that is all the chars put together.
From there I could do whatever with the string finalfreq.

How the heck could I do this? Any help would be SUPER awesome! Thanks in advance! :slight_smile: :slight_smile: :slight_smile:

I would not use Strings at all.

char freq1 = '2';
char freq2 = '7';
char freq3 = 'T';
char freq4 = 'K';

char finalfreq[5];

void setup() {
  Serial.begin(115200);
  finalfreq[0] = freq1;
  finalfreq[1] = freq2;
  finalfreq[2] = freq3;
  finalfreq[3] = freq4;
  Serial.print(F("result is '"));
  Serial.print(finalfreq);
  Serial.println('\'');
}
void loop() {}
result is '27TK'

Whandall:
I would not use Strings at all.

An interesting solution! My true goal is to use software serial to print finalfreq to another Arduino, then eventually print it to a connected to the other Arduino. Could I do that with this array system?

stupid-questions:
An interesting solution! My true goal is to use software serial to print finalfreq to another Arduino, then eventually print it to a connected to the other Arduino. Could I do that with this array system?

Classic example of asking something while the question to solve is something else

Just do

Serial.print(freq1); // or Serial.write() depending if you need ASCII or binary out
Serial.print(freq2);
Serial.print(freq3);
Serial.print(freq4);

You don't really need to concatenate them (although yes an array would work)