Function
A function is a set of statements that together execute a task. Every C++ program has at least one function, which is main(), and any more trivial program can define other functions.
Dividing a program into functions is an important principle of top-down and structured programming. Another advantage of using features is that it is possible to reduce the size of a program by calling and using them in different parts of the program.
Example:
int show( int n, int m) { int k; k= n + m; cout<<"The value of k = "<<k<<endl;
}
Function Prototype
The function prototype is one of the key enhancements to C++. This prototype describes the function interface to the compiler by giving details such as the number and type of arguments and the type of return values.
This is the declaration statement in the calling program and is in the form below:
Type function-name (argument-list if any);
Example: float volume(int x, float y, float z);
Note: Each argument variable must be declared independently inside the parentheses. A combined declaration like float volume(int x, float y, z); is illegal.
