嵌入式笔试面试题(2)---大小端

2019-07-12 18:45发布

1、如何判断CPU是大端还是小端,请书写对应程序2、在小端存储上,下面程序的输出是什么?typedef struct node{ unsigned char a:2; unsigned char b:2; unsigned char c:4;}Node;union a{ struct node A; char b;}B;union { int a; char b;}C;int main(){ printf("the isze of union is %d ",sizeof(B)); B.b=100; printf("the B.A.c=%d ",B.A.c);}