There is no safe way to enumerate a struct's members, unless the exact contents of the struct is known, and even in that case you have to be careful of things like struct alignment/padding.
Depending on your problem, it might be safer to have an array of your struct.