title: char array assignment in a loop in C?
body: <p>So I know this has something to do with pointers and/or memory allocation, but I'm not quite sure how to fix it. For some reason, the following code prints nothing, when it should be printing the first character in a file (designated by a path "filename").</p>
  
  <pre><code>    int text[1000] = {};  
  
      FILE *fp;
      fp = fopen( filename, "r" );
      int i = 0;
      while(1) {
          int c = fgetc(fp);
          if ( c==EOF ) {
              break;
          } else {
              text[i] = c;  
          }
      }
  
      printf ( "%c", text[0] );
  </code></pre>
  
  <p>Thanks!</p>