1

What is the difference in dereferencing a function pointer with and without parentheses. both the mechanism are working same on linux Gnu Gcc.

void (*fp)(void); //function pointer

void func(void);

fp = func; 

(*fp)();  //dereferencing with parentheses

fp(); // without parentheses
Gopi
  • 19,784
  • 4
  • 24
  • 36
Usr1
  • 369
  • 1
  • 6
  • 15
  • Doppelgänger : http://stackoverflow.com/questions/6893285/why-do-all-these-crazy-function-pointer-definitions-all-work-what-is-really-goi – Quentin Jan 14 '15 at 10:18

1 Answers1

1

You need to know that

(*fp)() = fp()

The function pointer can be called in both the ways and both are valid and same.

Check the below link:

How does dereferencing of a function pointer happen?

Community
  • 1
  • 1
Gopi
  • 19,784
  • 4
  • 24
  • 36