I wanted to start on a huffman program and the first thing is to read from stdin and generate a simple frequency list. I read that it's nice to generate an additional pseduo-EOF and give it frequency of 1 so that later when you encode/decode you know when to stop. I've been able to generate the table but I haven't been able to add this extra character and I was wondering if anyone knew how to add this terminating character so that the program knows when to stop encoding/decoding.
This only gives me the chars that appear in the text and their frequency but I haven't been able to generate the extra EOF char with freq = 1.
unsigned long array;
//while ( (ch = getchar()) != EOF)
for(int i = 0; i < 256; i++)
printf("%d\t%lu\n", i, array[i]);