Conteúdo do Curso
Introduction to C++
Introduction to C++
Constant
In the previous chapters, we printed some expressions. However, what to do if we need to store these expressions for future usage? In C++ (like in other programming languages) there are containers to keep data - variables. For each type of data (numbers, strings, characters) there is a type of variable.
Let’s take a look at the most often used types:
The variable x
will always be 42 and nobody can change it. The following code would cause an error:
You should declare variables as constants if you are sure that they will probably never change:
Obrigado pelo seu feedback!