Function decay
Function decay is the C conversion of a function designator to a pointer to that function except in contexts such as sizeof and unary &.
Modern C, Third Edition
Function decay is the C conversion in which an expression designating a function is converted to a pointer to that function in applicable contexts.
- How it is used
- Uses function decay to pass functions as callbacks and invoke them through function pointers.
- How deep it goes
- Explains conversion rules, equivalent call forms, declarations, callbacks, and comparison safety, stopping short of broader pointer internals.
- Examples
- Demonstrates equivalent calls, atexit declarations, qsort callbacks, safe unsigned comparison, and overflow-prone integer comparison.
- What you can do after
- Apply it via function-pointer callbacks and distinguish safe comparison implementations from overflow-prone ones.
Modern C
Function decay is the C conversion in which an expression naming a function is evaluated as a pointer to that function, except in contexts that suppress the conversion.
- How it is used
- Uses function decay to pass callbacks and select functions through function-pointer interfaces.
- How deep it goes
- Defines decay, compares declaration forms, and traces call expressions, while deferring broader pointer details.
- Examples
- Demonstrates equivalent calls, callback declarations, generic comparison functions, sorting, searching, and selectable logging.
- What you can do after
- Apply function decay when declaring, passing, storing, and invoking callback functions.
Related concepts
- function pointer typeproduces · A function pointer is a value that designates a callable function and can be stored, passed, or invoked indirectly.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

