title: How to know the virtual address of the data & code in C and C++?
body: <ol>
  <li><p>How can one get the virtual address of the data &amp; code in a program?</p>
  
  <p>One might say use <code>%u</code> or <code>%p</code> or something else.</p>
  
  <pre><code>printf("%u", &amp;data);
  printf("%p", &amp;data);
  </code></pre>
  
  <p>I'm always confused; which one gives correct address? Both give addresses but what's the difference? </p></li>
  <li>Is there any way we can say which part of memory a given virtual address belongs to? Can we identify that it's a stack address or a heap address or something else?</li>
  </ol>