Finding the address of a variable from another process
<p><a href="https://i.stack.imgur.com/cqnVF.jpg" rel="nofollow noreferrer">visual studio screenshot with memory window open</a></p>
<p>Hi, I wonder if someone could kindly give me some info on something please?</p>
<p>Let's say that i have two programs, <code>program1</code> and <code>program2</code>.</p>
<p>I have this code in <code>program1</code>:</p>
<pre class="lang-cpp prettyprint-override"><code>int number = 100;
int* p = &amp;number;  // p = 0x0050f594
</code></pre>
<p><code>p</code> is pointing to the memory address <code>0x0050f594</code></p>
<p>And in <code>program2</code> I have this:</p>
<pre class="lang-cpp prettyprint-override"><code>int* p = (int*)0x0050f594;
</code></pre>
<p>So to me, <code>p</code> from <code>program2</code>, points to the variable number from <code>program1</code>.</p>
<p>I think it's something to do with different applications running in their own address space, but I would still like to know how to make <code>program2</code>'s <code>p</code> pointer point to the number variable from <code>program1</code>?</p>