For this structure,
typedef struct division {
bool b;
union {
uint16_t i;
struct {
uint8_t j;
uint8_t k;
};
};
} type_t;
Why is the sizeof 4 and not 3? As I understand, the bool takes 1 byte. Then the union is allocated with the largest member's size. Since both the struct and the uint16_t are 16 bytes, the union should be 2 bytes. Then 2+1 would be 3. Where is the additional byte coming from?