Bel*_*ing 3 c struct bit-fields
我有以下C代码.
struct values{
int a:3;
int b:3;
int c:2;
};
void main(){
struct values v={2,-6,5};
printf("%d %d %d",v.a,v.b,v.c);
}
Run Code Online (Sandbox Code Playgroud)
当我执行代码时,我得到以下输出:
2 2 1.
Run Code Online (Sandbox Code Playgroud)
但输出应该是2 -6 5,对吧?
如果我错了请解释.