The main Function
// function main begins program execution
is another single-line comment indicating that program execution begins at the next line.
is a part of every C++ program. The parentheses after
main indicate that main is a program building block called a function. C++ programs typically consist of one or more functions and classes (as you’ll learn in Chapter 3). Exactly one function in every program must be named
main. Figure 2.1 contains only one function. C++ programs begin executing at function
main, even if
main is not the first function defined in the program. The keyword
int to the left of
main indicates that
main returns an integer value. The complete list of C++ keywords can be found in Fig. 4.2 ...