title: C: How to store strings into a “char *myArray[100]” array?
body: <p>I created this piece of code in C to read a text file line by line and store each line into a position of an array:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #include &lt;stdlib.h&gt;
  
  static const int MAX_NUMBER_OF_LINES = 100000;
  static const char filename[] = "file.csv";
  
  int main ( void )
  {
  
    // Read file and fill the Array
    char *myArray[MAX_NUMBER_OF_LINES];
    int numberLine = 0;
    FILE *file = fopen (filename, "r");
    if (file != NULL)
    {
        char line [128];
        while (fgets (line, sizeof line, file) != NULL)
        {
            myArray[numberLine] = line;
            numberLine++;    
        }
        fclose (file);
    }
  
    // Print the Array
    for (int i = 0; i&lt;numberLine; i++)
    {
      printf("%d|%s", i, myArray[i]);
    }
  }
  </code></pre>
  
  <p>But when printing the array, it's empty. What am I doing wrong?</p>