So if an asterisk precedes the pointer name, it refers to the value of the address being pointed to
int anInteger = 30;
int* pointer = &anInteger;
*pointer;
While without having this operator preceding the pointer name, it refers to the value of the pointer itself, i.e. the address of what the pointer is pointing to
pointer;
(PLEASE correct me if I am wrong or if you just got some tips to share :) ) To me, this means that the above code can be translated to following with the assumption that the address of "myInteger" is 1234:
int* pointer = 1234;
30;
1234;
Now to what confuses me - Since that variables refer to locations in memory and names refer to the variables, it is odd to me that you do this when you want to change the value of a variable indirectly using a pointer:
*pointer = 15;
Because that could then be translated to 30 = 15, which does not look very valid..
Also, when you change the value of the variable directly, you do it like this:
anInteger = 33;
where "anInteger" would refer to the variable and thereby the memory address and because of that, I would translate this code to this:
1234 = 33;
SO, because of this, why don't you do this when assigning a new value to a variable indirectly using a pointer:
pointer = 33;
The exact question: Why do you write *pointername = 33; instead of pointername = 33?