let say I have a program like this,
typedef struct
{
float hello;
} tData;
int main()
{
printf("%d", sizeof(tData));
}
The value is 4, as the float is 4 bytes. It showed as expected.
However, when I add a new variable,
typedef struct
{
uint8_t bool1:1;
float hello;
} tData;
int main()
{
printf("%d", sizeof(tData));
}
I thought that it should display 5, but I got 8. May I know why?