Quelqu'un peut-il m'aider avec ce code simple ??erreur de pointeur de fonction
#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;
}
Je reçois l'erreur suivante:
error: invalid types `void (*[3])()[void()()]' for array subscript|
qui est vraiment des choses mal, par la manière. –