title: Two-dimensional char array too large exit code 139
body: <p>Hey guys I'm attempting to read in workersinfo.txt and store it into a two-dimensional char array. The file is around 4,000,000 lines with around 100 characters per line. I want to store each file line on the array. Unfortunately, I get exit code 139(Not enough memory). I'm aware I have to use <code>malloc()</code> and <code>free()</code> but I've tried a couple of things and I haven't been able to make them work.Eventually I have to sort the array by ID number but I'm stuck on declaring the array.
  The file looks something like this:</p>
  
  <pre><code>First Name, Last Name,Age, ID
  Carlos,Lopez,,10568
  Brad, Patterson,,20586
  Zack, Morris,42,05689
  </code></pre>
  
  <p>This is my code so far:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  int main(void) {
  
  
  FILE *ptr_file;
  char workers[4000000][1000];
  
  
  
  
  ptr_file =fopen("workersinfo.txt","r");
  if (!ptr_file)
      perror("Error");
  
  
  int i = 0;
  while (fgets(workers[i],1000, ptr_file)!=NULL){
  
      i++;
  }
  
  int n;
  for(n = 0; n &lt; 4000000; n++)
  {
      printf("%s", workers[n]);
  }
  
  fclose(ptr_file);
  return 0;
  }
  </code></pre>