HP C A.06.05 Reference Manual
Expressions and Operators
Function Calls
Chapter 5106
Function Calls
Syntax
postfix-expression ( [argument-expression-list] )
Description
Function calls provide a means of invoking a function and passing arguments to it.
The postfix-expression must have the type “pointer to function returning T”. The result of the
function will be type T. Functions can return any type of object except array and function.
Specifically, functions can return structures. In the case of structures, the contents of the
returned structure is copied to storage in the calling function. For large structures, this can
use a lot of execution time.
Although the expression denoting the called function must actually be a pointer to a function,
in typical usage, it is simply a function name. This works because the function name will
automatically be converted to a pointer.
C has no call statement. Instead, all function references must be followed by parentheses. The
parentheses contain any arguments that are passed to the function. If there are no
arguments, the parentheses must still remain. The parentheses can be thought of as a postfix
call operator.
If the function name is not declared before it is used, the compiler enters the default
declaration:
extern int
identifier
();
Function Arguments
Function arguments are expressions. Any type of object can be passed to a function as an
argument. Specifically, structures can be passed as arguments. Structure arguments are
copied to temporary storage in the called function. The length of time required to copy a
structure argument depends upon the structure's size.
If the function being called has a prototype, each argument is evaluated and converted as if
being assigned to an object of the type of the corresponding parameter. If the prototype has an
ellipsis, any argument specified after the fixed parameters is subject to the default argument
promotions described below.