I want to get an iterator to struct variable to set a particular one on runtime according to enum ID. for example -
struct {
char _char;
int _int;
char* pchar;
};
enum {
_CHAR, //0
_INT, //1
PCHAR //2
};
int main()
{
int i = 1; //_INT
//if i = 1 then set variable _int of struct to some value.
}
can you do that without if/else or switch case statements?
See Question&Answers more detail:os