Function pointer definition- A pointer which keeps address of a function is
known as function pointer. A function pointer is a variable which is used to hold the starting address of a function and same can be used to invoke a function. It is also possible to pass address of different functions at different times thus making a function more flexible and abstract. So the function pointers can be used to simplify code by providing a simple way to select a function to execute based on run-time values.
Syntax- ReturnType (*PointerToFunction) (arguments if any)
Example- #include<stdio.h>
void my_func (int x) { printf(%d\n,x); } Int main () { void (*foo) (int); // ptr to function foo=&my_func; foo(10); return 0; } In the above example function pointer foo is used to call the function my_func.