title: Why are the memory addresses of string literals so different from others', on Linux?
body: <p>I noticed that string literals have very different addresses in memory than other constants and variables (Linux OS): they have many leading zeroes (not printed).</p>
  
  <p>Example:</p>
  
  <pre><code>const char *h = "Hi";
  int i = 1;
  printf ("%p\n", (void *) h);
  printf ("%p\n", (void *) &amp;i);
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>0x400634
  0x7fffc1ef1a4c
  </code></pre>
  
  <p>I know they are stored in the <code>.rodata</code> part of the executable. Is there a special way the OS handles it afterwards, so the literals end up in a special area of memory (with leading zeroes)? Are there any advantages of that memory location or is there something special about it?</p>