Possible Duplicate:
how to use array of function pointers?
I am wondering how one can declare in C a dynamic list of function pointers ? Using a pointer to function pointer ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A pointer to a function pointer, with which you can use to point to a block of dynamically allocated memory. Let’s say the function type is
void (int):Or you may want an array to function pointers, in which case:
You can change the parameter and the return type of the functions.
An array of function pointers can be used as a map from number to function to be executed. It is one way to do emulation – for example, after you have obtained the OP code from the instruction, you can execute the operation by using the array of pointer. (This is one way to do so, but I’m not sure whether it is actually done in emulation code).