Function prototyping is one of the key improvements added to the C++ functions. When a function call is encountered, the compiler checks the function call with its prototype so that correct arguments types are used. The compiler checks the function call with its prototype so that correct argument types are used. The compiler informs the user about any violations in the actual parameters that are to be passed to a function.
A function prototype is a declaration statement which has the following syntax:
type function_name (argument list);
The type specifies the data type of the value in the return statement. The function can return any data-type; if there is no return value, a keyword «void» is placed before the function name. The function declaration terminates with a semicolon.
Consider the prototype statement:
int max(int x, int y); //prototype
It informs the compiler that the function max has two arguments of the type integer. Function declaration are also called as prototype.