HP C A.06.05 Reference Manual

Data Types and Declarations
Declarators
Chapter 3 59
If a function declarator is not part of a function definition, the optional
identifier-list
must be empty.
Function declarators using prototype form are only allowed in ANSI mode.
Functions can also return structures. If a function returns a structure as a result, the called
function copies the resulting structure into storage space allocated in the calling function. The
length of time required to do the copy is directly related to the size of the structure. If pointers
to structures are returned, the execution time is greatly reduced. (But beware of returning a
pointer to an auto struct — the struct will disappear after returning from the function in
which it is declared.)
The function declarator is of equal precedence with the array declarator. The declarators
group from left to right. The following are examples of function declarators:
int f(); /* f: Function returning an int */
int *fp(); /* fp: Function returning pointer to an int */
int (*pf)(); /* pf: Pointer to function returning an int */
int (*apf[])(); /* apf: Array of pointers to functions returning int */
Note that the parentheses alter the binding order in the declarations of pf and apf in the
above examples.