Course Content
C++ Introduction
C++ Introduction
3. Introduction to Operators
4. Introduction to Program Flow
5. Introduction to Functions
Entry Point of a Program
Every C++ program must have a main() function. The syntax of it looks like this:
int main()
: the starting point of a program. It's called the main function, and it's where the program begins executing;{ }
: curly braces define a block of code. Everything inside these braces belongs to the main function and is part of the program's logic;return 0;
: marks the end of the program and indicates that it ran successfully. The 0 means everything went well. If there were issues, this value might be different in the output.
Note
The
return 0;
statement is optional at the end of the main function. If omitted, the compiler will automatically insert it.
Everything was clear?
Thanks for your feedback!
Section 1. Chapter 3