set project up to use C99 dialect
fix warning about size_t in printf
rewrite 'for' loops to declare iterator inside