JC Lawrence wrote this many years ago. It was popular then and seems to continue to help peope tracking pointer nesting and function pointers:
int j_func(); /* Function prototype -- Function returning
an int. */
int *pj_func(); /* Function prototype -- Function returning
a pointer to an int */
int *(pj_func()); /* Same thing as above but with explicit
parenthesis */
int (*prj_func)(); /* Variable declaration -- Pointer to a
function returning an int */
int *(*prpj_func)(); /* Variable declaration -- Pointer to a
function returning a pointer to an int */
int (**pprj_func)(); /* Variable declaration -- Pointer to a
pointer to a function returning an int */
int (*aprj_func[])(); /* Variable declaration -- Array of
pointers to functions which return int. */
int *(xx_func())(); /* ERROR -- Bad prototype. This attempts
to declare xx_func as a function which
returns a function which returns a pointer. */
int ((*xx_func) ())(); /* ERROR -- Bad variable declaration. This
declares that xx_func is a pointer to a
function which returns a function. */
int (*(prprj_func()))(); /* Function prototype -- Function which
returns a pointer to a function which
returns an int. */
--
TWikiGuest - 07 Dec 2001