title: Assigning value to the address pointed to by pointer? C++
body: <p>So if an asterisk precedes the pointer name, it refers to the value of the address being pointed to</p>
  
  <pre><code>int anInteger = 30;
  int* pointer = &amp;anInteger;
  *pointer;
  </code></pre>
  
  <p>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</p>
  
  <pre><code>pointer;
  </code></pre>
  
  <p>(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:</p>
  
  <pre><code>int* pointer = 1234;
  30;
  </code></pre>
  
  <hr>
  
  <pre><code>1234;
  </code></pre>
  
  <p>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:</p>
  
  <pre><code>*pointer = 15;
  </code></pre>
  
  <p>Because that could then be translated to 30 = 15, which does not look very valid..</p>
  
  <p>Also, when you change the value of the variable directly, you do it like this:</p>
  
  <pre><code>anInteger = 33;
  </code></pre>
  
  <p>where "anInteger" would refer to the variable and thereby the memory address and because of that, I would translate this code to this:</p>
  
  <pre><code>1234 = 33;
  </code></pre>
  
  <p>SO, because of this, why don't you do this when assigning a new value to a variable indirectly using a pointer:</p>
  
  <pre><code>pointer = 33;
  </code></pre>
  
  <p>The exact question:
  Why do you write *pointername = 33; instead of pointername = 33?</p>