Function pointer type
A function pointer is a value that designates a callable function and can be stored, passed, or invoked indirectly.
Modern C
A function pointer is a pointer value that designates a function and can be passed to or invoked by other code.
- How it is used
- Deploys function pointers for callbacks, generic searching and sorting, selectable logging behavior, and thread entry functions.
- How deep it goes
- Explains decay, declaration syntax, invocation forms, generic callbacks, and exact type matching, with detailed comparison examples.
- Examples
- Uses atexit declarations, equivalent calls, qsort comparisons, logging tables, and thrd_create callbacks as concrete examples.
- What you can do after
- Apply it via C callback interfaces, typedef readable signatures, implement comparison functions, and select functions through pointer variables or tables.
Modern C, Third Edition
A function pointer is a C pointer value that designates a function and can be used to invoke or pass that function indirectly.
- How it is used
- Deploys function pointers for indirect calls, callbacks, generic algorithms, configurable behavior, and thread entry functions.
- How deep it goes
- Explains decay, declaration syntax, equivalent calls, callback contracts, and exact matching, while stopping short of broader pointer internals.
- Examples
- Uses equivalent call expressions, qsort and bsearch comparison functions, configurable loggers, and thrd_create callbacks.
- What you can do after
- Build callback-based C interfaces and apply qsort, bsearch, logging, or thread creation with correctly matched function types.
Read how Modern C, Third Edition explains function pointer type →
Refactoring to Rust
A function pointer is a value that refers to a callable function and can be passed as an argument or stored for later invocation.
- How it is used
- Uses function pointers to register callbacks across the NGINX HTTP FFI boundary.
- How deep it goes
- Defines the Rust and C callback signatures and demonstrates invocation, but defers general function-pointer behavior beyond this FFI case.
- Examples
- Demonstrates `read_body_handler` passed as `Some(...)` to NGINX request-body parsing.
- What you can do after
- Apply it via Rust FFI by declaring a C-compatible callback type and passing a matching handler to an API.
Read how Refactoring to Rust explains function pointer type →
Rust in Action: Systems programming concepts and techniques
A function pointer is a value that identifies a function and can be passed or stored so that the function can be invoked indirectly.
- How it is used
- Supplies callbacks that an operating system can invoke, particularly registered signal handlers.
- How deep it goes
- Explains executable-code addresses, pointer casts, and function signatures through small programs; does not develop a general callback API.
- Examples
- Uses an address-printing `noop` program and a `libc::signal` shutdown-handler program.
- What you can do after
- Apply it via `libc::signal` to register a handler and recognize why the example casts its function address.
Related concepts
- function decayproduced by · Function decay is the C conversion of a function designator to a pointer to that function except in contexts such as sizeof and unary &.
- callused by · A function call is an operation or expression that invokes a function or other callable, optionally supplies arguments, and initiates its execution.
- referencekind of · A reference is an indirect value or relationship that identifies or provides access to another value, object, resource, or source.
- closurecontrasts with · A closure is a function or callable value together with access to bindings from the lexical environment in which it was created.
- callbackused by · A callback is a function or other callable supplied to software for invocation later in response to a specified event, condition, or point in execution.
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.



