title: how virtual addresses assigned?
body: <p>Take this C code for example </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  int main() {
  
      int x;
      int* y = (int *) malloc(10*sizeof(int));
  
      printf("%p\n",&amp;x);
      printf("%p\n",y);
      printf("%p\n",&amp;(y[1]));
  
      while(1);
  
      return 0;
  }
  </code></pre>
  
  <p>Which will print virtual addresses that look something like this </p>
  
  <p>0x7ffd4e96d214</p>
  
  <p>0x908010</p>
  
  <p>0x908014</p>
  
  <p>The virtual addresses will be different every time you run the binary file which made me think how the virtual address are actually decided for a program ?</p>