Pointers to Functions in C

Last Updated Nov 20, 2015, 07:00:14 PM





Just like pointers to arrays, you can create pointers to function which are used to pass callbacks to other functions

The pointers we use with functions holds the address location of functions and its data. The pointer to function format would look like int (*pointer_name) (int a, int b)

Syntax

Try It Now

In the above pointer to functions example, we have a function named "myfunction" which takes two integer type variables as input. And we have a function pointer named "funcptr" and then we assigned value to it.



Other Pointer Topics you might want to learn

Pointers to Arrays in C
Pointers in C