don't understand pointers still | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

don't understand pointers still

I still cannot understand pointers and their use. I don't know why but I just dont. sorry if this is a super basic question.

20th Sep 2016, 2:41 AM
StephenG
4 Answers
+ 14
pointer points to a value and its adress(where its located) example : int art=50; int *pa=&art; //*declared that *pa is pointing to art and its value*\\ //*if i say *\\ cout<<&art; //*then the output will be the address of the int art=50 (meaning its location)*\\ //*if i say *\\ cout<<*pa; //* it will display the value int art=50 is holding*\\ so cout<<&art; will display(for example) fxei29d (address) and cout<<*p; will display the value int art is holding so it will display 50 int *pa :is the pointer pointing to the int art=50 &art :is the address of int art=50 int *pa=&art :establishes that the pointer is pointing to the int art=50 this is what i understand about how pointers work i only recently started programing, i hope i was of help
20th Sep 2016, 8:06 PM
Ignatius
Ignatius - avatar
+ 1
I'm confused what the address is, I understand assigning pointers and all that. But once it gets to storing the pointer info... to me that sounds like where the cursor is, but I feel it's explained as it the location of where an object is. is it possible to provide a usable example (not the code, just what you'd use it for usually)?
22nd Nov 2016, 1:53 AM
Matt James
Matt James - avatar
0
thank you that was very helpful.
29th Sep 2016, 7:32 PM
justin
0
Youre not Alone! :)
8th Oct 2016, 6:02 PM
Rox Has
Rox Has - avatar