title: malloc() returning a null pointer
body: <p>I'm attempting a C programming assignment where I need to iterate through each index of each line of a document, and set an integer value at each character index in a corresponding array ar:</p>
  
  <pre><code>//Jagged array ar containing pointers to each row
  int* ar[line_count];
  //The size of each row is the line width * the size of an int ptr
  const int line_size = max_width * sizeof(int*);
  
  //For each line
  for (i = 0; i &lt; line_count; i++)
  {
      //If the first runthrough, copy the blank array 
      if (i == 0)
      {
          ar[i] = malloc(line_size);
          memcpy(ar[i], blank_ar, line_size);
      }
      //Otherwise, copy from the last row
      else
      {
          ar[i] = malloc(line_size);
          //This is set to a null pointer after several runthroughs
          memcpy(ar[i], ar[i - 1], line_size);
      }
      //Edit the current row ar[i]
  }
  </code></pre>
  
  <p>The only problem is, after some 9 iterations, malloc starts returning a null pointer that causes memcpy to (obviously) not work.</p>
  
  <p>Is there any reason this is happening? There is no way I'm running out of memory as I only allocate these tiny arrays 9 times.</p>