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

Cursusinhoud

Introduction to C++

Introduction to C++

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

book
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:

python

The variable x will always be 42 and nobody can change it. The following code would cause an error:

python

You should declare variables as constants if you are sure that they will probably never change:

python
question-icon

Define the variable secondsPerMinute as const varible:

;

Click or drag`n`drop items and fill in the blanks

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 2. Hoofdstuk 8
Onze excuses dat er iets mis is gegaan. Wat is er gebeurd?
some-alt