可能重复:
Why isn't sizeof for a struct equal to the sum of sizeof of each member?为什么C中struct的大小不等于所有变量大小的总和;
这是我的结构和它的大小是40,但所有变量的大小是34 我怎么能消除这种结构的额外空间?
typedef struct
{
USHORT SequenceNumber;
USHORT LinkCount;
USHORT AttributeOffset;
USHORT Flags;
ULONG BytesInUse;
ULONG BytesAllocated;
ULONGLONG BaseFileRecord;
USHORT NextAttributeNumber;
USHORT Padding;
ULONG MFTRecordNumber;
USHORT UpdateSeqNum;
} FILE_RECORD_HEADER, *PFILE_RECORD_HEADER;
http://stackoverflow.com/questions/119123/why-isnt-sizeof-for-a-struct-equal-to-the-sum-of-sizeof-of-each-member Dupe? – 2010-11-16 06:25:52