Lesson 22 of 50 · c
Function Pointers
Duration: 11 mins
A function pointer stores the address of a function and can be invoked like a regular function.
int add(int a, int b) { return a + b; }
int (*op)(int,int) = add; // pointer to function
printf("%d\n", op(2,3)); // prints 5
Useful for callbacks, tables of operations, and implementing polymorphism in C.