Call subroutine

Is it possible to call a subroutine with a name composed by text and a number from a variable?

void loop() {
  for (int i = 0; i>2; i++){
    SubRoutine & i(); // Call subroutine?
  } 
}


void SubRoutine0(){
  // Do something
}

void SubRoutine1(){
  // Do something
}

void SubRoutine2(){
  // Do something
}

Gnuff:
Is it possible to call a subroutine with a name composed by text and a number from a variable?

void loop() {

for (int i = 0; i>2; i++){
   SubRoutine & i(); // Call subroutine?
 }
}

void SubRoutine0(){
 // Do something
}

void SubRoutine1(){
 // Do something
}

void SubRoutine2(){
 // Do something
}

You need an array of function pointers.

#define ARRAY_SIZEOF(ARRAY) (sizeof(ARRAY) / sizeof(ARRAY[0]))

typedef void (*funct_ptr)(void);

void SubRoutine2()
{   }

void SubRoutine1()
{   }

void SubRoutine0()
{   }

void loop()
{
    static funct_ptr functions[] =
    {
          SubRoutine0
        , SubRoutine1
        , SubRoutine2
    };

    for (int i = 0; i < ARRAY_SIZEOF(functions); i++)
    {
        (*functions[i])();
    } 
}

void setup()
{   }

Anytime you find yourself with a bunch of the same things and you are adding a number to them to distinguish them, then you should start thinking of using an array.

Works perfectly. Thanks