LOOP FOR CHANGING THE VARIABLE INSIDE DYNAMICALLY

Good morning everyone.

The idea is as follows: imagine that in a program there are 4 variables called variable1, variable2, variable3 and variable4. I want to do a FOR loop by running Serial.println on each of these 4 variables, but I don't want to write the name of each variable explicitly within the loop. I want to use the loop indexer (the i, for example) as a differentiator for the variable. Something like this:

void loop() {
variable1 = "a";
variable2 = "b";
variable3 = "c";
variable4 = "d";
for (int i = 1; i <= 4; i++) {
Serial.println(variable+i);
}
}

The parameter (variable + i) is just an idea. I know it doesn't work that way.

How to increase this?

Thanks
Gilberto

Make the variable an array:

uint8_t variable[4];

and index them in the for loop:

    for( uint8_t index=0; index<4; index++ )
        Serial.println( variable[index];
.
.
.
void loop()
{
  const char *variable1 = "a";
  const char *variable2 = "b";
  const char *variable3 = "c";
  const char *variable4 = "d";


  const char *variable[5] = {"", variable1, variable2, variable3, variable4};
  
  for (int i = 1; i <= 4; i++)
  {
    Serial.println(variable[i]);
  }
}

Many thanks!