I'm confused about pointers in C++. May I please have some assistance with understanding this key concept of C++ programming? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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.

18th Jun 2018, 6:32 PM
Drew Seedot
Drew Seedot - avatar
4 Answers
+ 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
18th Jun 2018, 7:22 PM
Aaron Eberhardt
Aaron Eberhardt - avatar
+ 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
18th Jun 2018, 8:05 PM
Max
Max - avatar
18th Jun 2018, 7:19 PM
Aaron Eberhardt
Aaron Eberhardt - avatar
+ 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.
19th Jun 2018, 6:01 AM
Rational Agent