S
Sandeep
struct x
{
int a;
char b;
int c;
char d;
};
typedef struct x X;
int main()
{
printf("Sizeof X:%d\n",sizeof(X));
return 0;
}
output of above : 16 .
Stroustrup says that to optimize space, the members should be ordered
by size ( largest member first).
Why do the compilers not optimize it automatically? In other words,
when would i need the memory layout of the structure to be mainted as
it is declared.
{
int a;
char b;
int c;
char d;
};
typedef struct x X;
int main()
{
printf("Sizeof X:%d\n",sizeof(X));
return 0;
}
output of above : 16 .
Stroustrup says that to optimize space, the members should be ordered
by size ( largest member first).
Why do the compilers not optimize it automatically? In other words,
when would i need the memory layout of the structure to be mainted as
it is declared.