Can anybody help me with this simple code??
#include <iostream>
using namespace std;
void testFunction(){
cout<<"This is the test function 0"<<endl;
}
void testFunction1(){
cout<<"This is the test function 1"<<endl;
}
void testFunction2(){
cout<<"This is the test function 2"<<endl;
}
void (*fp[])()={testFunction,testFunction1,testFunction2};
int main(){
//fp=testFunction;
(*fp[testFunction1])();
//cout<<"Addrees of the function pointer is:"<<*fp;
}
I am getting the following error:
error: invalid types `void (*[3])()[void ()()]' for array subscript|