I am using an array of function pointers as below to avoid a switch
statement in the code.
void E_func1(void);
void E_func2(void);
void E_func3(void);
void (*pfGetVal[3])() = {
E_func1,
E_func2,
E_func3
};
But while running misra (pclint), I am getting the error below:
conversion between a pointer to function and another type [MISRA 2012 Rule 11.1, required]
Do I need to use typedef
?
I tried as below but didn't work.
void (*pfGetVal[3])();
pfGetVal[0] = E_func1;
pfGetVal[1] = E_func2;
pfGetVal[2] = E_func3;