Features of the main()
Function
Stripped of the trimmings, the sample program shown in Listing 2.1 has the following fundamental structure:
int main(){ statements return 0;}
These lines state that there is a function called main()
, and they describe how the function behaves. Together they constitute a function definition. This definition has two parts: the first line, int main()
, which is called the function header, and the portion enclosed in braces ({
and }
), which is the function body. (A quick search on the Web reveals braces also go by other names, including “curly brackets,” “flower brackets,” “fancy brackets,” and “chicken lips.” However, the ISO Standard uses the term “braces.”) Figure 2.1 shows the main()
function. The function ...
Get C++ Primer Plus now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.