title: Segmentation fault in C while trying to declare an array of strings.
body: <p>"fruits.txt" is a text file that starts with a number, say n,  followed by the names of n fruits.I want to store those n names into an array of strings, but while trying to declare that array, I am getting "Segmentation fault(core dumped) error.</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;stdlib.h&gt;
  int main()
  {
      FILE *fp;
      int count;
      fp = fopen("fruits.txt", "r");
      if(fp == NULL)
      {
          printf("Can't open file!!");
          exit(0);
      }
  
      fscanf(fp, "%d", &amp;count);
      printf("%d\n", count);
      char *fruits[count]; // This line is giving Segmentation fault.
      fclose(fp);
  
      return 0;
  }  
  </code></pre>