function pointer array

Trying to create an array of function pointers so I can invoke a function knowing only its index into the array. This code is as close as I can get it to code by the legendary Nick Gammon, but it won't compile:

    typedef void (*taskPointer) ();
    
    void task1(){}
    void task2(){}
    void task3(){}
    
    taskPointer callTask[] = {
    task1,
    task2,
    task3,
    };

Trying to create an array of function pointers so I can invoke a function knowing only its index into the array.

Following Nick Gammon’s example at https://www.gammon.com.au/callbacks

void task1() {
  Serial.println("Task1");
}
void task2() {
  Serial.println("Task2");
}
void task3() {
  Serial.println("Task3");
}

typedef void(*taskPointer)();

taskPointer callTask[] = {
  task1,
  task2,
  task3
};

void setup()
{
  Serial.begin(115200);
  Serial.println("starting callTask Demo");
  
  for (byte j = 0; j < 3; j++)
  {
    callTask[j]();//need index and extra brackets()to call the function
  }
}

  void loop() {}

Well of course that won't compile. It's not a full sketch. The problem is obviously somewhere else.

DON'T POST SNIPPETS! It just pisses off everyone involved.

Jiggy-Ninja:
Well of course that won't compile. It's not a full sketch.

Nor have you shared the reported compiler error with us.

Compiles fine for me:

typedef void (*taskPointer) ();


void task1() {}
void task2() {}
void task3() {}


taskPointer callTask[] =
{
  task1,
  task2,
  task3
};


void setup()
{
  (callTask[0])();
  (callTask[1])();
  (callTask[2])();
}
void loop() {}