Possible Duplicate:
Why isn't sizeof for a struct equal to the sum of sizeof of each member?
I have a simple C struct defined like this:
typedef struct LMWinData {
UInt8 itemTypeID;
UInt16 serviceID;
UInt16 methodID;
} LMWinData;
Later in code I define a variable of this type like this one:
LMWinData lmWinData;
Now, if I print out the size of this variable:
NSLog(@"data has size of %lu bytes", sizeof(lmWinData));
I don't get the value (5 bytes) as expected. I get a size of 6 bytes instead.
So, what's wrong here?
Thanks a lot!
(I'm using Mac OS X Lion.)