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
c function pointers


source to share


No one has answered this question yet

See similar questions:

8
& operator optional in function pointer assignment

or similar:

6493
var functionName = function () {} vs function functionName () {}
3076
What are the differences between a pointer variable and a reference variable in C ++?
2256
Set default parameter value for JavaScript function
1699
What is a smart pointer and when should I use it?
1642
What's the difference between a method and a function?
1483
Why should I use a pointer and not the object itself?
1153
What does an exclamation mark do in front of a function?
1119
How do function pointers work in C?
402
Typedef function pointer?
3
Call function pointed to by void * pointer



All Articles
Loading...
X
Show
Funny
Dev
Pics