Iterate through struct variables

后端 未结 4 576
孤独总比滥情好
孤独总比滥情好 2020-12-11 08:00

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* pcha         


        
4条回答
  •  南笙
    南笙 (楼主)
    2020-12-11 08:42

    No. C and C++ does not permit this.

    You have to de the if/else or switch/case statements.

提交回复
热议问题