3

I was hoping someone could clear up a question I have about the correct way to reference function pointers. Or clarify the difference in usage.

The majority of literature I've seen (including http://en.wikipedia.org/wiki/Function_pointer#Example_in_C ) declares and references pointers (using the SINE function for example) like

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) reference them such as

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

I admit my interpretation based on the wiki pages listed above may be incorrect so any clarification would be greatly appreciate.

Thanks, Jeff

Ken White
  • 123,280
  • 14
  • 225
  • 444
WoodMath
  • 521
  • 2
  • 8
  • 14

0 Answers0