<p>I understand the overall meaning of pointers and references(or at least I think i do), I also understand that when I use <b>new</b> I am dynamically allocating memory.</p>

<p>My question is the following:</p>

<p>If i were to use <code>cout &lt;&lt; &amp;p</code>, it would display the "virtual memory location" of <code>p</code>.
Is there a way in which I could manipulate this "virtual memory location?"</p>

<p>For example, the following code shows an array of <code>int</code>s.</p>

<p>If I wanted to show the value of <code>p[1]</code> and I knew the "virtual memory location" of <code>p</code>, could I somehow do "<code>&amp;p + 1</code>" and obtain the value of <code>p[1]</code> with <code>cout &lt;&lt; *p</code>, which will now point to the second element in the array?</p>

<pre><code>int *p;
p = new int[3];

p[0] = 13;
p[1] = 54;
p[2] = 42;
</code></pre>

Sure, you can manipulate the pointer to access the different elements in the array, but you will need to manipulate the content of the pointer (i.e. the address of what p is pointing to), rather than the address of the pointer itself.
```
```
int *p = new int[3];
p[0] = 13;
p[1] = 54;
p[2] = 42;

cout << *p << ' ' << *(p+1) << ' ' << *(p+2);
```
```
Each addition (or subtraction) mean the subsequent (prior) element in the array. If p points to a 4 byte variable (e.g.
int
on typical 32-bits PCs) at address say 12345, p+1 will point to 12349, and not 12346. Note you want to change the value of what p contains before dereferencing it to access what it points to.