Declaring a function - function prototypes

type functionName( type [argname] [, type, ...] );
Example:
// declare a function prototype for the add function, taking two integer 
// arguments and returning their sum
int add (int lhs, int rhs);

In C and C++, functions must be declared before the are used. You can declare a function by providing its return value, name, and the types for its arguments. The names of the arguments are optional.

A function definition counts as a function declaration.



Related articles

Functions tutorial