implement solution interator in C