0

I have heard this term tossed around, can anybody explain what it means and what problem it solves. Also where does this originate from.

user5899005
  • 401
  • 1
  • 4
  • 5
  • 1
    Possible duplicate of [What is a callback function?](http://stackoverflow.com/questions/824234/what-is-a-callback-function) – Noam Hacker Feb 21 '16 at 17:00

1 Answers1

3

Simplified it's when you pass a function to another function, and that other function call you back using the function you passed.

It's useful for asynchronous programming, when events can happen at any time. Or for generic handling of certain functionality to make some algorithms more generic (for example in C++ you can pass a comparison function to the std::sort function, and your comparison function will be used to compare two items when sorting).

Some programmer dude
  • 363,249
  • 31
  • 351
  • 550