title: Storing data in list c
body: <p>The idea of my program is to read data from a file (in this case file includes 5 names), and store them in a list, so I can use the data later to for example calculating the min/max characters.  So far I have been able to read the data and print it out, but rather than printing, I'd want to save them to a list. I couldn't find a way around how to do this, so I'd appreciate some help.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  int main(void) {
  
      char file, filename[25];
      FILE *f;
  
      printf("Enter the file name: ");
      scanf("%s", filename);
  
      f = fopen(filename, "r");
  
      if (f == NULL)
      {
          perror("No file found.\n");
          return 0;
      }
  
      printf("The contents of %s file are:\n", filename);
  
      while((file = fgetc(f)) != EOF)
          printf("%c", file);
  
      fclose(f);
  
      return 0;
  }
  </code></pre>