c++ - What value does a Pointer to a Pointer print if not a single dereference operator is used at all? -
i have tried output of following code. but, don't yet understand might value of q represent.
i understand *q points p implying that, printing *q print address of p, **q print value @ address p points to, i.e., x(=5).
#include <iostream> using namespace std; int main() { int x=5; int *p,**q; p=&x; q=&p; cout<<q; return 0; }
so q alone represent? value printed when q printed?
p.s: i'm c++ noob , have searched answer question elsewhere , seem not find it. if find answer somewhere else, please forgive me , notify me , i'll remove question.
you say:
printing *q print address of p
however not true. printing q
print address of p
. after all, assigned in doing q = &p;
.
printing *q
print value of p
, address of x
.
Comments
Post a Comment