Function pointers (ambiguous syntax)

I was hoping someone could resolve the question I have about the correct way to reference function pointers. Or clarify the difference in use.

Most of the literature I have seen (including http://en.wikipedia.org/wiki/Function_pointer#Example_in_C ) declares and references pointers (for example using the SINE function), for example

double (*fnPtr)(void) = sin;

      

However, a number of other sites (including http://en.wikipedia.org/wiki/Callback_(computer_programming) and http://www.cprogramming.com/tutorial/function-pointers.html ) link to them, for example

double (*fnPtr)(void) = &sin;

      

I admit that my interpretation based on the wiki pages listed above may be wrong, so any clarification would be very helpful.

Thanks, Jeff

+3


source to share





All Articles