title: realloc not copying first index
body: <p>I'm having some trouble with using the malloc/realloc command with arrays. I've created a small array with some integers in it, and tried to add one value to it by expanding the size with realloc and adding the value, but when I do that the 0 index's value is not preserved and is seen as garbage.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  int main(){
          int n;
          printf("Enter size of array\n");
          scanf("%d",&amp;n);
          int *A = malloc(n*sizeof(int));
          for(int i = 0; i &lt; n; i++){
                  A[i] = i + 1;
          }
          *A = realloc(A, sizeof(A)+ sizeof(int));
          A[n] = 1234;
          for(int i = 0; i &lt; n + 1; i++){
                  printf("%d\n",A[i]);
          }
  
  
          return 0;
  }
  </code></pre>
  
  <p>and when i run the program this happens: </p>
  
  <pre><code>Enter size of array
  5
  14643216
  2
  3
  4
  5
  1234
  </code></pre>
  
  <p>Does anyone know why the 0 index of the array is getting this value and not 1?</p>