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

Зміст курсу

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:

;

Натисніть або перетягніть елементи та заповніть пропуски

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 2. Розділ 8
some-alt