I have a few questions. This isn't homework. I just want to understand better.
So if I have
int * b = &k;
Then
kmust be an integer, andbis a pointer tok's position in memory, correct?What is the underlying "data type" of
b? When I output it, it returns things like0x22fe4c, which I assume is hexadecimal for memory position2293324, correct?Where exactly is memory position '2293324'? The "heap"? How can I output the values at, for example, memory positions
0,1,2, etc?If I output
*b, this is the same as outputtingkdirectly, because*somehow means the value pointed to byb. But this seems different than the declaration ofb, which was declaredint * b = k, so if*means "value of" then doesn't mean this "declarebto the value ofk? I know it doesn't but I still want to understand exactly what this means language wise.If I output
&b, this is actually returning the address of the pointer itself, and has nothing to do withk, correct?I can also do
int & a = k;which seems to be the same as doingint a = k;. Is it generally not necessary to use&in this way?