Hi I am having difficulties in understanding about how the memory is allocated to the structure elements.
For example if i have the below structure and the size of c
to avoid structure padding!
#pragma pack ( 1 )
directive can be used for arranging memory for structure members very next to the end of other structure members.
#pragma pack(1)
struct temp
{
int a; // size is 4
int b; // size is 4
double s; // size is 8
char ch; //size is 1
};
size of structure would be:17