+ 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.
4 Réponses
+ 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
+ 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)?
0
thank you that was very helpful.
0
Youre not Alone! :)