Re: [algogeeks] Re: whats a CALL BACK in C?

2012-05-31 Thread Bhavesh agrawal
Here is an example of callbacks in C. Let's say you want to write some code that allows registering callbacks to be called when some event occurs. First define the type of function used for the callback: typedef void (*event_cb_t)(const struct event *evt, void *userdata); Now, define a function

[algogeeks] Re: whats a CALL BACK in C?

2012-05-28 Thread Gene
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