KrisKasprzak
Well-known member
I have a an array of strings and I want top copy to another array, but I can't get strcpy to work. No compile errors, it just wont run
Anyone lend me a hand?
Anyone lend me a hand?
Code:
const char *Old[10] = {"Red", "Green", "Blue"};
char *New[10];
void setup() {
Serial.begin(9600);
while (!Serial);
}
void loop() {
CopyStringsDarnIt(Old);
for (int k = 0; k < 10; k++) {
Serial.println(New[k]);
}
}
void CopyStringsDarnIt(const char *old[]) {
Serial.println("ok upto here");
for (int k = 0; k < 10; k++) {
Serial.println(k);
strcpy(New[k], Old[k]);
Serial.println("strcpy fails why....");
}
}