- 很好奇,Keil IED到底是大端模式还是小端模式,刚才测试了一下。。
- #include"stdio.h"
- typedef struct
- {
- unsigned char b:4;
- unsigned char c:4;
- }tow;
- typedef union TWO
- {
- unsigned char a;
- tow yy;
- };
- void main(void)
- {
- union TWO xx;
- xx.a=0x35;
- printf("b=%d\n",xx.yy.b);
- printf("c=%d\n",xx.yy.c);
- while(1);
- }
|