Function Pointer

In my Apple interview, I was shown this syntax in C++ and was a little rusty with that.

// Define callback signature.
typedef void (*DoneCallback) (int reason, char *explanation);
// A method that takes a callback as argument.
void doSomeWorkWithCallback(DoneCallback done)
    if (done) {
       done(1, "Finished");
// A callback
void myCallback(int reason, char *explanation)
    printf("Callback called with reason %d: %s", reason, explanation);
// Put them together