Why **?
quote:Original post by Typhoon
A pointer to a pointer is used to change values of what a pointer is pointing to, I think.
o_O
No, it''s not. Maybe you''re thinking of the dereferencing operator?
quote:Original post by twixquote:Original post by Typhoon
A pointer to a pointer is used to change values of what a pointer is pointing to, I think.
o_O
No, it''s not. Maybe you''re thinking of the dereferencing operator?
Something like this
type **ptr;
a pointer to a pointer.
*ptr will change I thing what a pointer points to and **ptr will change the thing a pointer points is what I meant.
I still don''t understand you, but I think you know what a pointer pointer is. Just work on expressing yourself clearly.
a pointer to pointer is just a pointer variable that holds the address of another pointer variable i think..
so if i declare
int **A;
int *B;
int C;
C = 10;
B = &C
/* *B would equal 10 */
A = &B
/* pointer to pointer A now holds the address where pointer variable B is located */
A would retrieve the address of B
*A would retrieve the value of B which is the address of C
**A would retrieve the value of C which is 10
Am i Right? I dunno. Plz correct me.
so if i declare
int **A;
int *B;
int C;
C = 10;
B = &C
/* *B would equal 10 */
A = &B
/* pointer to pointer A now holds the address where pointer variable B is located */
A would retrieve the address of B
*A would retrieve the value of B which is the address of C
**A would retrieve the value of C which is 10
Am i Right? I dunno. Plz correct me.
Correct DangerDuo. A pointer to a pointer is just that. Its a way to change the address to which the associated pointer is pointing. Typically you see this in things like functions that must change the pointer. They will have a **ptr arguement and would be called like so: func(&ptr); I''ve also heard them called double-pointers as well, saying ''pointer to a pointer'' is kind of a pain, though ''double-pointers'' could be seen as a bit ambiguous.
Ravyne, NYN Interactive Entertainment
[My Site][My School][My Group]
Ravyne, NYN Interactive Entertainment
[My Site][My School][My Group]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement