Answer the question
In order to leave comments, you need to log in
pointer addresses?
cout <<"значение= "<< *b <<"\tадрес= 0х"<<b<<" =0x"<< &b<< endl;
Answer the question
In order to leave comments, you need to log in
Because pointers are, first of all, the same variables as any others (this is very important to understand). The second output value is the value of b, and it doesn't really matter if it's a pointer or not (in our case, yes, a pointer, and so the output value of b is some address). The third value printed is the ADDRESS of b, and it doesn't matter what type b is. You can declare int b or float b and get the same result.
That's what is the distinguishing point of the pointer - it's just the same first displayed value, or rather, the very possibility of deriving it. For pointers (as well as for any user-defined types that implement operator*), a dereference operation is available. This makes it possible to take the value of the variable b, interpret it as an address, and then, in turn, get into memory at this address and get the value from there. In this case, it can be argued that the value 66 is located at address 0x011CD1C0 (if it is interpreted according to the type of pointer).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question