That's a pretty general question. Basically, a callback function is used to generalize a function so that it can performed a user-defined (user in the sense of a "user programmer" that uses the function) function on a set of data.
qsort() uses this mechanism where the user creates a comparison function (4th argument to qsort()) which qsort() calls as needed to sort the array elements.
In C, callback functions are implemented with function pointers.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.