How to access members through a void pointer

前端 未结 4 1459
我寻月下人不归
我寻月下人不归 2021-01-15 20:29

Started by trying to write a small program to translate basic arithmetic into English, I end up building a binary tree(which is inevitably very unbalanced) to represent the

4条回答
  •  梦毁少年i
    2021-01-15 21:15

    you could cast it:

    ((s*)p)->i1=1;
    ((s*)p)->i2=2;
    

    I don't see any entity_flag in struct s but if you mean expr the same applies:

    unsigned char flag=((expr*)vp)->entity_flag;
    

提交回复
热议问题