title: Do we lose data in a buffer after realloc'ing?
body: <p>I'm having troubles understanding how realloc works. If I malloc'ed a buffer and copied data to that buffer, let's say "AB":</p>
  
  <pre><code> +------------+
   | A | B | \0 |
   +------------+
  </code></pre>
  
  <p>then I realloc'ed the buffer, will there be any lost in the data (even a single byte)?; or it just does expanding the buffer? :</p>
  
  <pre><code> +------------------------+
   | A | B | \0 | ? | ? | ? |
   +------------------------+
  </code></pre>
  
  <p>code:</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;stdlib.h&gt;
  #include&lt;string.h&gt;
  
  int main(void){
  
      char* buffer    = (char*) malloc( sizeof(char) * 3 );
      strncpy(buffer, "AB", 2);
  
      buffer          = (char*) realloc(buffer, sizeof(char) * 6); /* Will there be any lost here? */
      free(buffer);
      return(0);
  }
  </code></pre>