Every C++ program has a function named main. In addition, it may have other functions which will be dealt with later. The basic form of any function is:
TYPE FN_NAME ( PARMS ) BODY
Each of these is discussed in separate exhibits, indicated by the menu letters. The example from the earlier program is:
int main() // the header of main
{ // the body follows
cout << "Hello World!\n";
return 0;
}
where:
a) the TYPE is int (integer)
b) the FN_NAME is main, which is the name of the function
c) the PARMS is empty, that is, none are present in this example
d) the BODY is the two statements cout and return enclosed in braces.
or
s) Visit the Statement exhibit
x) Return to the Basics exhibit
Links:
The return type
The function name
The parameters
The function body
Statements
Basics of C++