This is an old school project. Just posted it on the off chance that someone might want to use it as an example.
It contains three programs that are almost identical:
huffbin: A program to create standard binary huffman codes. hufftern: A program to create ternary huffman codes. huffgen: A program to create huffman codes of an arbritrary radix.
This was done on DOS Borland C but should be easy to convert.
A full writeup is here