本帖最后由 slf123123 于 2021-4-19 09:13 编辑
typedef unsigned long DWORD; #pragma pack(push)
#pragma pack(1)
typedef struct si
{
DWORD a:4;
DWORD b:7;
DWORD c:3;
DWORD d:1; DWORD e:3;
DWORD f:14;
}si;
#pragma pack(pop)
如上所示这个结构体对齐后是四个字节 然后 uint8 buff[4]; 怎么将buff赋值给整个结构体 struct si su={buff[0],buff[1],buff[2],buff[3]}; 这样赋值不行吗 |