February 2005
Beginner to intermediate
272 pages
4h 53m
English
It’s possible to declare a pointer to a function of a particular type.
void (*fp)(int); // ptr to function
Note the required use of parentheses to indicate that fp is a pointer to a function that returns void, not a function that returns void* (see Dealing with Function and Array Declarators [17, 61]). Like a pointer to data, a pointer to function may be null, or it may refer to a function of the appropriate type.

Note that it is not necessary to take the address of a function explicitly when initializing or assigning its address to a pointer to function; the compiler knows implicitly to take the function’s address, ...
Read now
Unlock full access