In C++11, why does int16_t have a size of 4 when declared after a float inside a struct?
I have a data structure like this:
struct mystruct
{
float f;
int16_t i;
};
sizeof(int16_t) gives 2, but sizeof(mystruct) gives 8 instead of 6. Why is that? How can I declare an int16_t variable of 2 bytes inside my data structure?
Aucun commentaire:
Enregistrer un commentaire