Examples of function declarations
The following code fragments show several function declarations
(or prototypes). The first declares a function f that
takes two integer arguments and has a return type of void:
void f(int, int);
This fragment declares a pointer p1 to
a function that takes a pointer to a constant character and returns
an integer:
int (*p1) (const char*);
The following code fragment declares a function f1 that
takes an integer argument, and returns a pointer to a function that
takes an integer argument and returns an integer:
int (*f1(int)) (int);
Alternatively, a typedef can be used
for the complicated return type of function f1:
typedef int f1_return_type(int);
f1_return_type* f1(int);
The following declaration is of an external function f2 that
takes a constant integer as its first argument, can have a variable
number and variable types of other arguments, and returns type int.
extern int f2(const int, ...);
Function f4 takes
no arguments, has return type void, and can throw
class objects of types X and Y.
class X;
class Y;
// ...
void f4() throw(X,Y);
