The callback was always confusing for me until today. Today, I wrote my own callback then put in the library. After that, In my c++ application I register my function to the callback. It was really cool the see my c++ function getting called from outside of my program. Especially, when it is my own callback function.
While I was doing this I came across a website which is really good to learn for the different aspect of the writing callback. You can access the website from here
If you go over the website and run the given examples, you will have a deep intuition of the callback function both in c and c++.
Have a wonderful day.