Suppose I have a struct with 20 members. I want to assign each of those structs with values. Instead of accesing by explicit convention, i.e.:
Is there any way to encapsulate it in a for loop and use an iterator variable to indicate the member? i.e.:Code:struct.member1 = 1; struct.member2 = 2; ... ... ... struct.member20 = 6;
The above is pseudocode but Im sure you get what Im trying to do?Code:for (int i = 0; i < 20; i++) struct.i = i;