Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
可能的重复: C 中的位域操作
我看到了一些 c 代码,typedef 一个结构,比如
typedef struct { unsigned a:1; unsigned b:1; unsigned c:1; unsigned rest:13; } Interface_type;
剂量是什么unsigned a:1;意思?
unsigned a:1;
unsigned a:1
定义一个只占用 1 位的位域。
见这里:http ://en.wikipedia.org/wiki/Bit_field
有符号变量(例如有符号整数)将允许您表示正负范围内的数字。
无符号变量,例如无符号整数,仅允许您以正数表示数字