Update freqaddr.c

Completely works. With comments. Perhaps more error checks needed though. Also efficiency is terrible.