相关代码 |
|
#include struct sss{ int i1:18; int i2:26; int :0; }; static union u{ struct sss sss; unsigned char a[sizeof (struct sss)]; } u; int main (void) { int i; for (i = 0; i < sizeof (struct sss); i++) u.a[i] = 0; u.sss.i1 = 262143.0; for (i = 0; i < sizeof (struct sss); i++) printf ("%x ", u.a[i]); printf ("\n"); u.sss.i2 = 67108863.0; for (i = 0; i < sizeof (struct sss); i++) printf ("%x ", u.a[i]); printf ("\n"); return 0; }