title: how to read multiple files from a 2d array in C
body: <p>i have to write a program that reads multiple files in a for loop and counts the words, sentences, and syllables of that file. My code in the function <strong>CountWords</strong> looks like this: (filenames is a 2d array with the names of the 17 files stored in it) </p>
  
  <pre><code>for (i = 0; i &lt; 17; ++i) {
      inputfile = fopen(filenames[i], "r");
      if (inputfile == NULL) {
  
          printf("File cannot be found, verify %s is in the correct location.\n", filenames[i]);
      }
      int c;
  
      while (c != EOF) {
  
          c = getc(inputfile);
          //code to count words/syllables/sentences
  
      }
      fclose(inputfile);
  </code></pre>
  
  <p>While it successfully counts it for the file in the 0th element, the rest of them come out as zero words, zero sentences, zero syllables. Is there something I am doing wrong? thank you for your insight</p>