首页上一页 1 下一页尾页 1 条记录 1/1页
C语言开发实战中的21章网络通信系统IP数据包问题
发表在C语言图书答疑
2016-02-27
是否精华
是
否
版块置顶:
是
否
typedef struct HeadIP
{
unsigned char headerlen:4;
unsigned char version:4;
unsigned char severtype;
unsigned short totallen;
unsigned short id;
unsigned short idoff;
unsigned char ttl;
unsigned char proto;
unsigned short checksum;
unsigned int sourceIP;
unsigned int destIP;
};
上面是书上ip数据包的,我想问一下位段结构不是只能有int类型,书上也有char是怎么回事?
{
unsigned char headerlen:4;
unsigned char version:4;
unsigned char severtype;
unsigned short totallen;
unsigned short id;
unsigned short idoff;
unsigned char ttl;
unsigned char proto;
unsigned short checksum;
unsigned int sourceIP;
unsigned int destIP;
};
上面是书上ip数据包的,我想问一下位段结构不是只能有int类型,书上也有char是怎么回事?