Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Constant | Variables
Introduction to C++ | Mobile-Friendly
course content

Conteúdo do Curso

Introduction to C++ | Mobile-Friendly

Introduction to C++ | Mobile-Friendly

1. Basics
2. Variables
3. Conditional Statements
4. Loops
5. Intro to Arrays

bookConstant

If you have a static variable that never changes and you want that nobody overrides your variable, use the const keyword by declaration. It makes the variable unchangable (constsant).

For example:

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:

question-icon

Define the variable secondsPerMinute as the const variable:

;

Clique ou arraste solte itens e preencha os espaços

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 2. Capítulo 8
some-alt