- [Instructor] This chapter is about the basic syntax
of the C++ language.
The idea is to have you dive into the language
with some real code right away.
By necessity, this means that we'll use language features
that have not yet been explained,
it will all be explained at some point in this course,
either in this chapter or in later chapters.
So, don't let this get in your way.
Go ahead and dive in, follow the exercises.
If something isn't immediately obvious to you, that's okay.
Just keep going and we'll get to it later.
The basic syntax of C++ is very simple.
A statement is a unit of code terminated by a semi-colon.
Statements are used for a variety of purposes,
to call functions, declare uninitialized variables,
or to operate on expressions.
A function is a larger unit of code
that may contain many statements.
A function is designed to be reused
or to be called by another statement.
The main function is the main entry point
of any C or C++ program.
You never need to call main yourself.
Main is called by the operating system
when your program first launches.
A variable holds a value or values for later use.
In C++, variables must be declared before they are used.
The variable may then be used to provide its value
to statements and expressions later in your code.
In the rest of this chapter,
we'll go through the basic syntax of C++ in more detail.
You'll learn how to construct
a syntactically correct program,
how to define variables, use pointers and references,
and how to use conditional expressions and loops.
Take your time, experiment with the exercises,
and be sure to go through the whole chapter.
Understanding these fundamental concepts
will help you to get the most out of the rest of the course.