开发者

C++ struct definition [duplicate]

开发者 https://www.devze.com 2023-01-02 14:16 出处:网络
This question already has answers here: 开发者_如何学Python Closed 12 years ago. Possible Duplicate:
This question already has answers here: 开发者_如何学Python Closed 12 years ago.

Possible Duplicate:

What does ‘unsigned temp:3’ means

I just found this code in a book (was used in an example)

typedef struct {
unsigned int A:1;
unsigned int B:1;
unsigned int C:1;
} Stage;

What is the meaning of this structure definition? (the A:1;)


Those are C bitfields. In compliant compilers, the combination of A B and C do not occupy more than one int. A, B, and C occupy one bit each in the integer.

0

精彩评论

暂无评论...
验证码 换一张
取 消