Changing code in array SOLVED

Having difficulty with this code - am trying to change the '?' in this array and assistance would be helpful. Also difficulty with posting this request using the updated EDGE

char Array[][7] = {"?1111z", "?2222z", "?3333z", "?4444z"};
char code1 = "A";

// change the code to whatever train we are running
for (int x = 0; x < 6; x++) {
String S1 = Array[x];
S1.replace("?", code1);
Serial.println(S1);
Array[x][x] = S1;
}

This declares/defines a 2 byte, zero terminated character array (C-string):

char code1[] = "A";

This declares/defines code1 as a single character:
char code1 = 'A';

This works to replace the '?' in the first C-string.

char Array[][7] = {"?1111z", "?2222z", "?3333z", "?4444z"};
Array[0][0] = 'A';
Serial.println(Array[0]);

Thank you got it.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.