Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lära Link Between Pointer and Variable | Pointers Fundamentals
C++ Pointers and References
course content

Kursinnehåll

C++ Pointers and References

C++ Pointers and References

1. Pointers Fundamentals
2. Pointer Arithmetic
3. References Fundamentals
4. Dynamic Memory Allocation

book
Link Between Pointer and Variable

When you modify the value through the dereferenced pointer, you are essentially modifying the content of the memory location it points to. This directly affects the original variable.

Remember

Changing the value through *(p_variable) is equivalent to changing the value of variable.

Uppgift

Swipe to start coding

  1. Declare and initialize the pointer with a variable address.
  2. Change the value of dereferenced pointer to zero.
  3. Output the variable value.

Lösning

cpp

solution

Switch to desktopByt till skrivbordet för praktisk övningFortsätt där du är med ett av alternativen nedan
Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 1. Kapitel 3
toggle bottom row

book
Link Between Pointer and Variable

When you modify the value through the dereferenced pointer, you are essentially modifying the content of the memory location it points to. This directly affects the original variable.

Remember

Changing the value through *(p_variable) is equivalent to changing the value of variable.

Uppgift

Swipe to start coding

  1. Declare and initialize the pointer with a variable address.
  2. Change the value of dereferenced pointer to zero.
  3. Output the variable value.

Lösning

cpp

solution

Switch to desktopByt till skrivbordet för praktisk övningFortsätt där du är med ett av alternativen nedan
Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 1. Kapitel 3
Switch to desktopByt till skrivbordet för praktisk övningFortsätt där du är med ett av alternativen nedan
Vi beklagar att något gick fel. Vad hände?
some-alt