|
-
February 26th, 2002, 03:57 AM
#1
small Q on sizeof
Dear Gurus, please refer the following code
typedef struct _iphdr
{
unsigned int h_len:4;
unsigned int version:4;
unsigned char tos;
unsigned short total_len;
} IpHeader;
when I check the size of the above structure,
IpHeader m;
int i = sizeof(m);
system said "8", why? the first two int have taken 8 byte, plus 1 char, plus 2 byte short, it should be 11 byte.
thanx a lot ahead.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|