C Language Function Pointers Mnemonic for writing function pointers


Example

All C functions are in actuality pointers to a spot in the program memory where some code exists. The main use of a function pointer is to provide a "callback" to other functions (or to simulate classes and objects).

The syntax of a function, as defined further down on this page is:

returnType (*name)(parameters)

A mnemonic for writing a function pointer definition is the following procedure:

  1. Begin by writing a normal function declaration: returnType name(parameters)
  2. Wrap the function name with pointer syntax: returnType (*name)(parameters)