A function name refers to a fixed function. Sometimes it is useful to call a function to be determined at run time; to do this, you can use a function pointer value that points to the chosen function (see Pointers).
Pointer-to-function types can be used to declare variables and other data, including array elements, structure fields, and union alternatives. They can also be used for function arguments and return values. These types have the peculiarity that they are never converted automatically to void * or vice versa. However, you can do that conversion with a cast.
• Declaring Function Pointers | How to declare a pointer to a function. |
• Assigning Function Pointers | How to assign values to function pointers. |
• Calling Function Pointers | How to call functions through pointers. |