简体   繁体   English

c结构位字段

[英]c structures bit fields

A code snippet is as follows: 代码段如下:

struct wer
{
unsigned int a:5;
unsigned int:0;
unsigned int b:3;
unsigned int c:2;
unsigned int:0;
}v;

I know that all of these are packed bit fields but how to find the storage which would be needed for v. 我知道所有这些都是打包的位字段,但是如何找到v所需的存储。

您可以使用sizeof(v)获得v所需的存储空间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM