struct test{
int year;
char text;
double num;
};
int main ()
{
test t;
cout<<sizeof(t);
return 0;
}
The result is 16, while I was expecting 13. Since sizeof(char) is 1. What am I missing here?
struct test{
int year;
char text;
double num;
};
int main ()
{
test t;
cout<<sizeof(t);
return 0;
}
The result is 16, while I was expecting 13. Since sizeof(char) is 1. What am I missing here?
C++ may add padding between members. The struct might therefore be larger than the added size of its members.