title: Seg fault when using a variable to offset an array
body: <p>I am trying to add one character at a time to a char array, called buffer. When I try to add a character to buffer[count], I get a segmentation fault. However if I try to add a character to buffer[0], buffer[1], or any other integer offset it runs fine.  Here is my code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  
  int main(int argc, char *argv[]){
      FILE * fp;
      char buffer[100];
  
      fp = fopen(*(argv+1), "r");
  
      if(fp == NULL){
          printf("File \"%s\" not found!\n", *(argv+1));
          return 0;
      }
  
      int curr_char;
      unsigned int count = 0;
      unsigned int min_len;
  
      while(!feof(fp)){
  
          curr_char = fgetc(fp);
  
          if((curr_char &gt;= 32) &amp;&amp; (curr_char &lt;= 126)){
              buffer[count] = curr_char;
              printf("%c", curr_char);
              count++;
  
              if(!((curr_char &gt;= 32) &amp;&amp; (curr_char &lt;= 126))){
                  break;
              }
  
          }
      }
  }
  </code></pre>
  
  <p>Why is buffer[count] not allowed?</p>