Understand Reference and Dereferencing Operators?
<p>Can someone please help me understand Reference and Dereference Operators?</p>

<p>Here is what I read/understand so far:</p>

<pre><code>    int myNum = 30;
    int a = &amp;myNum;   // a equals the address where myNum is storing 30,
    int *a = &amp;myNum;  // *a equals the value of myNum.
</code></pre>

<p>When I saw the code below I was confused:</p>

<pre><code>    void myFunc(int &amp;c)   // Don't understand this. shouldn't this be int *c?
    {
      c += 10;
      cout&lt;&lt; c;
    }

    int main()
    {
      int myNum = 30;
      myFunc(myNum);  
      cout&lt;&lt; myNum ;        
    }
</code></pre>

<p><code>int &amp;c</code> has the address to what's being passed in right? It's not the value of what's being passed in.</p>

<p>So when I do <code>c+=10</code> it's going to add 10 to the memory address and not the value 30. Is that correct?</p>

<p>BUT... when I run this...of course with all the correct includes and stuff...it works. it prints 40.</p>
