-
联合体该如何设置某一位
联合体如下:unionSFLAG{struct{uint8_tb0:1;uint8_tb1:1;uint8_tb2:1;uint8_tb3:1;uint8_tb4:1;uint8_tb5:1;uint8_tb6:1;uint8_tb7:1;uint8_tb8:1;uint8_tb9:1;uint8_tb10:1;uint8_tb11:1;uint8_tb12:1;uint8_tb13:1;uint8_tb14:1;uint8_tb15:1;}bits;uint16_tbytes;};unionSFLAGSflag={0};现在想设置b0位的值,该如何写代码,试用Sflag.bytes&=0x01;怎么不对呢???请高手帮助解决,谢谢!!
2024-05-05 2