C Pointers Question:
Tell me when would you use a pointer to a function?

Answer:
Pointers to functions are interesting when you pass them to other functions. A function that takes function pointers says, in effect, "Part of what I do can be customized. Give me a pointer to a function, and I'll call it when that part of the job needs to be done. That function can do its part for me." This is known as a "callback." It's used a lot in graphical user interface libraries, in which the style of a display is built into the library but the contents of the display are part of the application.
Previous Question | Next Question |
Can we add pointers together? | Tell me can the size of an array be declared at runtime? |