3 ms·
You use a function pointer when you don't know at compile time what function you are going to call at runtime. An example is plugins: you load a function from a
by exDM69 13y ago
You use a function pointer when you don't know at compile time what function you are going to call at runtime. An example is plugins: you load a function from a dll (or shared object) and you get a function pointer.
When dealing with native code, functions are just piles of instructions in memory (with executable bit set in memory protection) that comes from the "text" section of your binary file. The code is stored in memory and therefore has an address, through which they can be reached.