S
Sachin
typdef struct
{
int i;
char ch;
}str;
str str_var;
char x, y;
main()
{
//do nothing
}
In the above piece of code the structure needs a padding of 3 more
bytes (the total size of the structure variable being 8 bytes). Now
my question is, wont the compiler append x & y to the end of structure
and adds just 1 byte as the padding?
In my case I use MSVC compiler. When I checked the size of obj in the
map file the obj size was 12 bytes....shouldnt it be 8 bytes ideally??
Thanks in advance...
Regds
Sachin
{
int i;
char ch;
}str;
str str_var;
char x, y;
main()
{
//do nothing
}
In the above piece of code the structure needs a padding of 3 more
bytes (the total size of the structure variable being 8 bytes). Now
my question is, wont the compiler append x & y to the end of structure
and adds just 1 byte as the padding?
In my case I use MSVC compiler. When I checked the size of obj in the
map file the obj size was 12 bytes....shouldnt it be 8 bytes ideally??
Thanks in advance...
Regds
Sachin