6

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

0

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

i actually want to implement callback function through function pointers for the calculation of CRC through Direct Memory Access (DMA). Í have status bits to check whether DMA has successfully completed the data trnasfer or not? So, if I implement it in a way to check the status bits and once transfer is completed and status bits get the desired values, I can call my function to do further things. could you please differentiate between your proposal and my understanding.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.