Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lära Dereferencing | References & Pointers
C++ Intermediate | Mobile-Friendly
course content

Kursinnehåll

C++ Intermediate | Mobile-Friendly

C++ Intermediate | Mobile-Friendly

1. Data Types and Arrays
2. References & Pointers
3. Dynamic Memory
4. Functions

book
Dereferencing

To operate with the variable, you can also access it by dereferencing the variable's pointer. For example, you can change the value of the variable by using pointers:

123456
int b = 1; int *pb = &b; *pb = *pb + 2; // b = 1 + 2 b = 3 + *pb; // b = 3 + 3 cout << b << endl;
copy

In all the statements above, we added numbers to the value of b and assigned the result to the variable b.

question-icon

Decrease x by 3 using pointers.

int x = 1;
int *px = &x;

*px =
;

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

Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 2. Kapitel 3

Fråga AI

expand
ChatGPT

Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal

course content

Kursinnehåll

C++ Intermediate | Mobile-Friendly

C++ Intermediate | Mobile-Friendly

1. Data Types and Arrays
2. References & Pointers
3. Dynamic Memory
4. Functions

book
Dereferencing

To operate with the variable, you can also access it by dereferencing the variable's pointer. For example, you can change the value of the variable by using pointers:

123456
int b = 1; int *pb = &b; *pb = *pb + 2; // b = 1 + 2 b = 3 + *pb; // b = 3 + 3 cout << b << endl;
copy

In all the statements above, we added numbers to the value of b and assigned the result to the variable b.

question-icon

Decrease x by 3 using pointers.

int x = 1;
int *px = &x;

*px =
;

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

Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 2. Kapitel 3
Vi beklagar att något gick fel. Vad hände?
some-alt