【发布时间】:2012-09-12 07:16:07
【问题描述】:
我看到了一些c代码,typedef一个struct,比如
typedef struct
{
unsigned a:1;
unsigned b:1;
unsigned c:1;
unsigned rest:13;
} Interface_type;
unsigned a:1; 是什么意思?
【问题讨论】:
-
称为位域。
标签: c
我看到了一些c代码,typedef一个struct,比如
typedef struct
{
unsigned a:1;
unsigned b:1;
unsigned c:1;
unsigned rest:13;
} Interface_type;
unsigned a:1; 是什么意思?
【问题讨论】:
标签: c
【讨论】:
有符号变量,例如有符号整数,将允许您表示正数和负数范围内的数字。
无符号变量,例如无符号整数,只允许您以正数表示数字
【讨论】:
int a:1; 是什么意思,冒号