c - Function to get stored callback -


Suppose i have a variable that stores callback.

  Zero * (* function) (int, double);   

Now I would like to create a function, which will return this callback. I do not want that the user can access the callback directly but by the function It does not work:

  zero * (*) (int, double) getCallback ();   

My question is how would the prototype look like for such a function?

type typed callback type:

  typedef void * (* pf) (int, double); Pf getCallback ();   

This will also ensure that there is no mistake by typing the wrong signature manually.

Comments