开发者

how to mask members in a union

开发者 https://www.devze.com 2023-01-17 07:04 出处:网络
i have a union union filter_row { MAC_Filter MAC; IP_Filter IP; 开发者_运维百科TCP_Filter TCP; UDP_Filter UDP;

i have a union

union filter_row
  {
        MAC_Filter MAC;
        IP_Filter IP;
    开发者_运维百科    TCP_Filter TCP;
        UDP_Filter UDP;
        ICMP_Filter ICMP;
        ARP_Filter ARP;
  };

The members of this union are structure....how to mask the members of structures... Do I have to initialize them to all 1's initially???


All members of a union share the same storage space, enough to accommodate the alignment and size of the largest and most restrictive of the members. Normally, you'd also require a member in the structure to indicate what union member to use.

0

精彩评论

暂无评论...
验证码 换一张
取 消