I demonstrated to a teaching colleague how to use function pointers and how he could have an array of them. I set out the following code so that it can do an indexed submission:
typedef void (*VoidFunction)(); VoidFunction functions[] = {editProgramName, editProgramLength, editProgramCycles, editProgramNumberOfSets, editProgramEditSets, editProgramSave, editProgramCancel}; // now dispatch functions[scroll.arrayFocusIndex]();
And then he asked ... "How can I do this without typedef?" I found that after I tried to find different things that seemed to work, I had no idea. All the google hits I found always seemed to use typedef. Is there a way to do this inline without a typedef function pointer?
source share