Consider the following:
char arrayOne [100] {"First array."};
char arrayTwo [100] {"Second array."};
char oneA {'a'};
char oneB {'b'};
int one {1};
int two {2};
This is allowed:
char myArray [100] {oneA};
This is not:
myArray += oneA;
Fair enough: arrays are budgeted a certain amount of memory, and we can't go over it.
I can't do this either:
char myArray [] {arrayOne + arrayTwo};
But now here's this:
char myArray [] {arrayOne + oneA};
The compiler DOES allow that, with an invalid conversion from 'char*' to 'char' warning. (arduino's Serial.print() just results in a single mirrored question mark, though, so clearly something is up). Nevertheless: here the compiler does NOT object to adding beyond an array's length, at least for the sake of copying, not assigning. We can even do this, with the same warning / outcome:
char myArray[100]{strcat(arrayOne + one, (strcat(arrayTwo, two)))};
Meanwhile, this doesn't even give a warning:
String myString {arrayOne + oneA};
It doesn't yield anything when printed with Serial.print(), though.
So, I'm left very confused. I can't see any sense in when the + operator can and can't be used with C strings. Surely there must be some warning-free way of combining strings, at least for assignment, beyond just using loops to go through all the spots in the arrays.
Any insight into the rationale here would be appreciated.