What are function pointers and what are their typical use cases in systems-level C++?

Last updated 21 June 2026

  • A function pointer (declared ret(*name)(args)) stores a function's address so behavior can be called or passed at runtime. It carries no state.

  • Typical systems uses: callbacks to C APIs (qsort, signal, OS/driver hooks), dispatch tables for interpreters and state machines, and runtime-swappable strategies.

  • In pure C++ prefer std::function or lambdas when state is needed. Only non-capturing lambdas convert to raw function pointers.

  • https://www.interviewbit.com/embedded-c-interview-questions/
All C++ interview questions