Can bit-fields only be fields of a structure/union, never “normal”, “stand-alone” variables?
- 阅读更多 关于 Can bit-fields only be fields of a structure/union, never “normal”, “stand-alone” variables?
The field part of bit-fields seems to suggest that they can only be fields inside a structure or union. Can a bit-field be a typical "stand-alone" variable, outside any aggregate data-type like union or structure as follows: int sum:6; //Can this work as a declaration statement? sum=4; If not, why so? If bit-fields are basically intended to use less memory, why can't we declare any variable as a bit-field if we know it won't exceed that size? Bit-fields are only part of structs or unions because that's what the C standard allows. It would have been possible to decide differently. Why the