Interview Questions

What does typedef int (*funcptr)(); mean?

C Interview Questions and Answers


(Continued from previous question...)

What does typedef int (*funcptr)(); mean?

It defines a typedef, funcptr, for a pointer to a function (taking unspecified arguments) returning an int. It can be used to declare one or more pointers to functions:

funcptr pf1, pf2;

which is equivalent to the more verbose, and perhaps harder to understand

int (*pf1)(), (*pf2)();

(Continued on next question...)

Other Interview Questions