Is there a way to get all the elements of a structure, so I can use them and perhaps iterate over them and print them ?
A:
C does not provide a standard way to do this. However, you may be able to hack something using the C preprocessor and the offsetof
GNU C extension.
Pierre Bourdon
2009-11-26 19:17:28
+2
A:
This is possible with X-macros. See this answer where I demonstrate exactly this.
philippe
2009-11-26 19:19:58
This is in fact a duplicate of that questions, so we should close...
dmckee
2009-11-26 21:31:35
You're right, I voted to close this one, too.
philippe
2009-11-27 07:15:16