Search code examples
functionprogramming-languagescallbackcontinuationssubroutine

Callback functions: what are they in computer programming languages?


I see a lot of callback functions in low-level API's like Win32. But I am confused on what a callback function or callback subroutine is. Is an event in c# considered a callback function?


Solution

  • A callback function is a function that is passed to something else, which will later call the function to notify the user of something. This implies that there must be a way to pass a reference to a function to another, for instance a type of function pointer. In .NET, delegates are used.

    An event handler method is an example of a callback function.