-3

I am very curious to find out how and where function pointer is widely used in real world application. From my experience, I haven't had a chance to apply function pointer in any of my projects. I am wondering if this is just an academic fun thing to learn or does this have a real life application purpose.

Nguai al
  • 958
  • 5
  • 15
  • 3
    Real life example: `sort(array, comparator)`, where the comparator is a function pointer to a function which denotes the criteria on which the sorting is done. – Ervin Szilagyi Apr 30 '17 at 02:39
  • [What are function pointers used for, and how would I use them?](http://stackoverflow.com/q/1758564/995714) – phuclv Apr 30 '17 at 03:35

1 Answers1

0

Most common application will be using them as callback handlers on events. The core module, calls the function pointers designated as event handlers when event hits. Advantage of this approach will be, In case of change in any logic in any of event handlers,the core does not change, only the libraries holding handlers change,reducing overall efforts of testing

Pras
  • 4,047
  • 10
  • 20