After the function is loaded into the computer, it will take a piece of memory and have an address in memory, so this function also has an address.
1. Define function pointer
Let's take a look at the difference between two definitions:
Void (* funp) ();
Void * funp ();
The compiler's understanding of the former is: FUNP is a pointer, which points to a function without any parameters and returns Void.
The latter may understand the declaration of a function rather than a variable, that is, a function, the function name is FUNP, which has no parameters.
For most of this pointer statement, deliberately use the right left to analyze its specific meaning, because most of it uses left-right-left mode to declare. For example: void fun (int) {cout << a << endl;} void main (void) {void (* pfun) (@) (/ / defines a function pointer PFUN = FUN; // assignment to function pointer PFUN 10); RETURN;} Run results are: 102. Complex declarations and definitions
(1) Void * (* (* fp1) (int)) [10];
Meaning: fp1 is a pointer to a function, which has an INT type parameter and returns a pointer, which points to a pointer to 10 VOID pointer arrays.
3. Use the function pointer
Once the function pointer is defined, it must be given to a function of a function before use, and can be directly generated by a function, or it can be generated in a clear syntax & fun ().
4. Pointer array of functions