下面是一道关于位段的面试题:
点击(此处)折叠或打开
- #include <stdio.h>
- #include <stdlib.h>
- typedef struct
- {
- int a:2;
- int b:2;
- int c:1;
- }date;
- int main()
- {
- date t;
- t.a = 1;
- t.b = 3;
- t.c = 1;
- printf("%d\n",t.a);
- printf("%d\n",t.b);
- printf("%d\n",t.c);
- return 0;
- }