title: Getting weird characters using getc?
body: <p>So I'm starting to implement a Huffman tree, and to do that, I'm trying to get character values from stdin or a input file. The input file (just a string "cheese") is being added to the array freqcounts, where the index of freqcounts that is being added to is the ascii conversion of the character it reads. Now, it does that for the string (e is added to index 101, etc.) But then there are all these random characters (towards the end of the array, I think they might be null characters?) Being added, with numbers in the tens of thousands. Can anyone explain to me what's going on?</p>
  
  <pre><code>    int main(int argc, const char * argv[]) {
      int ch; //character to be used for getch
      int freqcounts[R];
      while(1){
          /*Something weird going on in here*/
          /*I'm getting the proper characters (supposed to be cheese) but then there are all these random nullesque characters
           with absurd counts that is fucking up my linked list*/
          ch=getc(stdin);
          if (ch == EOF){ //eof
              freqcounts[0]=1;
              break;
          }
          else{
              freqcounts[ch]++;
          }
      }
      for (int i=0; i&lt; R; i++){
          printf("%d", freqcounts[i]);
      }
      return 0;
  }
  </code></pre>