How to declare function pointer in header and c-file?

后端 未结 3 1170
清歌不尽
清歌不尽 2020-12-31 02:12

I\'m a little confused over how to declare a function pointer in a header file. I want to use it in main and a file called menus.c and declare it in menus.h I assume. We wan

3条回答
  •  梦毁少年i
    2020-12-31 02:53

    A pointer function itself does not have a function definition. It's nothing more than a pointer to a type, the type being specified by the return type of the function and the parameter list. What you need to do is define a function with the same parameter list and return type, then use your pointer function to hold that function's address. You can then call the function through the pointer.

提交回复
热议问题