struct size is different from typedef version?
Posted
by samoz
on Stack Overflow
See other posts from Stack Overflow
or by samoz
Published on 2010-05-06T03:41:30Z
Indexed on
2010/05/06
3:48 UTC
Read the original article
Hit count: 220
I have the following struct declaration and typedef in my code:
struct blockHeaderStruct {
bool allocated;
unsigned int length;
};
typedef struct blockHeaderStruct blockHeader;
When I do sizeof(blockheader), I get the value of 4 bytes back, but when I do sizeof(blockHeaderStruct), I get 8 bytes.
Why is this happening? Why am I not getting 5 back instead?
© Stack Overflow or respective owner