JohnSantaFe
asked on
size of structure member
I know that sizeof() doesn't necessarily return the sum of the sizes for all the structure members because of byte alignment issues. However, does sizeof() return the correct size when called on the individual members of the structure? Is this portable?
typedef struct {
uint8_t a;
uint16_t b;
uint32_t c;
} mystruct;
mystruct mystruct;
size_t size;
size = sizeof(mystruct.b)
Will size always equal 2 bytes?
Thanks.
typedef struct {
uint8_t a;
uint16_t b;
uint32_t c;
} mystruct;
mystruct mystruct;
size_t size;
size = sizeof(mystruct.b)
Will size always equal 2 bytes?
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER