相关疑难解决方法(0)

位域的概念

struct A
{
 int a:2;
 int b:3;
 int c:3;
};

int main()
{
 struct A p = {2,6,1};
 printf("\n%d\n%d\n%d\n",p.a,p.b,p.c);
 return 0;
}    
Run Code Online (Sandbox Code Playgroud)

输出为:-2,-2,1

在C complier和C++编译器中输出上述代码的内容是什么?为什么?

c bit-fields

4
推荐指数
1
解决办法
1028
查看次数

标签 统计

bit-fields ×1

c ×1