title: Change size of 2D dynamic array in C
body: <p>I create a 2D dynamic array:</p>
  
  <pre><code>a = (int**)calloc(n-1, sizeof(int));
  for(i = 0; i &lt; (n-1); i++)
      a[i] = (int*)calloc(n, sizeof(int));
  </code></pre>
  
  <p>Then I need to change its size (add new line):</p>
  
  <pre><code>a = (int**)realloc(a, n);
  a[n] = (int*)calloc(n, sizeof(int));
  </code></pre>
  
  <p>But when i want to print my array, </p>
  
  <pre><code>void Print(void){
      int i, j;
      for(i = 0; i &lt; (n-1); i++){
          for(j = 0; j &lt; n; j++){
              printf("%d\t", arr[i][j]);
          }
          printf("\n");
      }
  }
  </code></pre>
  
  <p>i have access violation. First line is printed...
  What should I do?</p>