A callback is a function, say B, that you provide to some other function F in order to control F's behavior.
The intuition is that F is defined with a "hole" in its specification that it fills up by "calling back" to the B you furnished. A simple example of a callback is the comparison function argument of qsort() . For a more interesting example, look up the API for zlib, which is nicely designed with several callbacks. The raw Win32 API also uses callbacks for various purposes. In the C language, callback is through a simple function pointer to B because that's all you have. In higher level languages, the function can carry data in a closure. With a Java-like object model, a "listener" object can be provided with both data and one or more methods. The normal way to approximate this higher level language behavior is by defining the C API with a void* parameter to F that it in turn passes back to B. So when you call F, you can also provide data for B to use when F calls it later. The zlib API uses this technique. On May 28, 4:22 pm, "rahul r. srivastava" <rahul.ranjan...@gmail.com> wrote: > whats a "CALL BACK" in C? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.