The solution to a query in the C programming language needs a deep understanding of the language, not just the syntax and sales pitch. I have learnt C programming since I joined campus; and worked in different projects which have augmented my skills in programming C. I will break the query into a set of smaller tasks which would be inclined to solving the problem, -- the idea of modularization. I would like to invite you for further discussions for details on the way forward.