Step Into C · Lesson 15 · Modeling Data
Function Pointers
Functions as values, typedefs, callbacks, qsort and dispatch tables.
- ~30 minreading and coding
- 4missions
- membersaccess
- Clanguage
Part of Step Into C. The full lesson, its missions and the real compiler and debugger are in the course. Try a free lesson first to see how it works.
Compiled code lives in memory like everything else, so every function has an address. A function pointer stores that address and lets you call the function indirectly.
In this lesson
- Functions have addresses too
- Reading the syntax
- typedef makes it readable
- Callbacks
- qsort: the standard library's callback
- Dispatch tables
Missions
- Point at a function
- Callback
- Sort with qsort
- Dispatch table