Parts of the Program

This program consists of a single function called main. This function, which appears on line 1, has two parameters (inside the parentheses) and returns a number value (the starting int).

A function is a single group of code lines that perform a particular task. It has a heading at the top, with the function name as the second word and a body that starts with an opening brace ({) and ends with a closing brace (}). The closing brace optionally ends with a semicolon. More details about functions will be discussed in Lesson 7, “Functions.”

main is a function that is required in all C++ programs. Your system provides the parameters it receives (called arguments for reasons beyond our interest in this lesson). These are

  • int argc ...

Get SAMS Teach Yourself C++ in 10 Minutes SECOND EDITION 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.