I'd like to initialize a bunch of variables by calling them in a for loop like this. The effect I'm hoping for is that I'd have three variables at the end aVar = 1, bVar =2, and cVar = 3.
char* variables[] = { "aVar", "bVar", "cVar"};
int values[] = { 1, 2, 3};
void setup(){
for (int i = 0; i < 3; i++){
int String(variables[i]) = values [i];
Serial.println(variables[i]);
}
}
Is there a way to do this?