Reputation: 2027
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 ?
Upvotes: 1
Views: 176
Reputation: 35856
This is possible with X-macros. See this answer where I demonstrate exactly this.
Upvotes: 2
Reputation: 10890
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.
Upvotes: 0