Is there any way to loop through a struct with elements of different types in C?

后端 未结 4 1732
迷失自我
迷失自我 2020-11-29 21:45

my struct is some like this

typedef struct {
  type1 thing;
  type2 thing2;
  ...
  typeN thingN;
} my_struct 

how to enumerate struct chil

4条回答
  •  一生所求
    2020-11-29 22:17

    There's no way to iterate through struct members in C language, regardless of whether the have the same size/type or different sizes/types.

提交回复
热议问题