+ 4
Why is it so hard to write a generic list?
3 Respuestas
+ 3
Are you talking about pure C language? It is possible to develop, but as you said it is difficult because C does not have template support. But you can use void types. you need to write a lot of boiler plate code.
+ 2
C without the ++ doesn't support the features that make this job easier. You can't just grab objects by the parent class and without polymorphism you're left building all the support to do that yourself. Pointers help but they're a two edged sword as you still have to handle type detection yourself. It's a good academic exercise like programming logic using only nands but, if this is for a real world application, you should probably go for a language with at least objects support.
0
Pointers are perfect for this in standard c. If you're having issues with it, it's likely because of the unusual operators and how they apply to their roles. Let us know if you are referring to a different C language.