Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between Callback function and normal function

i have googled a lot to find out the difference between normal function and callback function. Unfortunatley I could not understand. if we have to call a function inside another function, what is usefulness of passing it as a parameter to the function by using function pointers? Is it possible to call the function passed as a parameter in the form of function pointers somewhere outside the function, in which it is passed as parameter? if yes, please give me a rough idea of its implementation. Thanks

like image 238
muhammad ahsan Avatar asked May 24 '11 09:05

muhammad ahsan


Video Answer


1 Answers

Say you have a function that does some prolonged operation, like send email. You don't want to wait for it to finish, so you give it a callback function that will invoke once it's done. That's a major use of callbacks - notification of asynchronous operations. There are other uses.

like image 172
Assaf Lavie Avatar answered Oct 16 '22 12:10

Assaf Lavie