Variables in C++
Learn how to declare and initialize variables in C++.
We'll cover the following...
Variable declaration #
A variable declaration means that we want the compiler to reserve a space for a data with the given name and type.
The basic syntax for declaring a variable in C++ is:
📝Note: Don’t worry about the data types yet. We will cover these in detail in the next chapter. For this chapter, we will just work with int. int is used to store an integer value in a variable. A variable declared with an int data type cannot store floating-point values.
To declare a variable that can store an integer value, ...