A function pointer is a pointer value that designates a function. A function name used without following parentheses undergoes function decay: it becomes a pointer to the function's start and can be passed or invoked indirectly. section 11.4
typedef void atexit_function(void); // Two equivalent definitions of the same type, which hides a pointer typedef atexit_function* atexit_function_pointer; typedef void (*atexit_function_pointer)(void); // Five equivalent declarations for the same function void atexit(void f(void)); void atexit(void (*f)(void)); void atexit(atexit_function f); void atexit(atexit_function* f); void atexit(atexit_function_pointer f);
Compare equivalent declarations for a callback type and for a function parameter; typedefs can make pointer syntax easier to read. section 11.4
Calling through a function designator
For double f(double), the calls f(3), (&f)(3), (*f)(3), (*&f)(3), and (&*f)(3) are equivalent. Their abstract steps differ—decay, address-of, dereference, and call—but each invokes f. section 11.4
Function pointers make algorithms depend on another function. The comparison parameter of qsort and bsearch lets one generic operation handle arrays of different element types, provided the element size and comparison function agree. section 18.1.5 section 11.4
Keep these constraints explicit:
- Match function pointer types exactly when assigning or calling them. section 11.5
- Write comparison functions that return a strictly negative, positive, or zero result; subtracting integers can overflow. section 11.4
- Use a callback interface to select behavior at runtime, as with configurable logging or thread start functions. section 11.4 section 20.0



