Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 8
    Take a look at the link (last section) learncpp.com/cpp-tutorial/78-function-pointers Commented May 3, 2013 at 3:28
  • 28
    Should be noted that since c++11 using FunctionFunc = void (*)(); can be used instead. It is a bit more clear that you are just declaring a name for a type (pointer to function) Commented Jan 8, 2016 at 11:55
  • 1
    just to add to @user362515, a bit clearer form to me is: using FunctionFunc = void(void); Commented May 28, 2016 at 21:15
  • 5
    @topspin IIRC these two are not the same. One is a function pointer type, the other is function type. There is implicit conversion, that's why it works, IANA(C++)L so, one can step in and correct me. In any case, if the intend is to define a pointer type I think the syntax with the * is a bit more explicit. Commented May 31, 2016 at 18:11
  • 1
    Here is a related question I asked a long time ago about why both myFuncPtr() and (*myFuncPtr)() are both valid function calls. Commented Feb 5, 2022 at 2:01