0
I'm confused about pointers in C++. May I please have some assistance with understanding this key concept of C++ programming?
The title explains it all.
4 Réponses
+ 3
If a variable is a house, a pointer is the address. You can either access the content of the house directly or via its address. Sometimes it's more efficient to just pass the address, because other parts of the program don't need to have a copy of your house, but will find it through the address
+ 2
each byte in memory has a adress. a pointer is a variable that stores this adress and can be used to access the variable at the adress it stores
+ 1
a variable is essentially a block of memory where you can store data
this means for a variable their are two parts where in memory it's storing the data (where this is exactly is a called an address)and the data stored their itself. a pointer is a variable that stores an address as data in the pointer. dereferencing a pointer is where you access the data that in the location stored by the pointers data.