You declare a function pointer by making a copy of the function prototype:
- int MyFunction(int a, int b);
Then replace the function name with a pair of parentheses that have and * and the name of your pointer inside:
- int (*ptr)(int a, int b);
Then then you can assign the address of MyFubnction to your pointer:
Then when you:
you have called MyFunction.
Note that only a function with two int arguments that returns an int can be assigne to the pointer.
NEVER cast a function pointer unless you kjnow exactly what you are doing otherwise you have messed up the argument list and return value and that can cause a crash.