Hello!
I'm trying to write a library to implement iterators in C. The iterators should work on classical linked lists written in C, with each node being an instance of a struct containing a pointer to the following node. If I delegate to the library also the work of building the list the solution is clear, but I'd like to know if it's possibile to do something better. In particular, is it possible to create a general purpose function that receives as a parameter the head of a list created in the usual way (plus eventually other informations about it) and then is able to iterate on it without being bound to the specific implementation of that list?
Thanks in advance for any help!
P.S.: I know that using the C language for this task may seem mad, but this is part of an university work about studying the possibilities to implement the design patterns of object oriented languages even in languages without objects like C.