#include <stdio.h>
struct temp{
char b1;
double a;
int f;
};
int main()
{
struct temp temp1;
int size = 0;
size = sizeof(temp1);
}
why size value is 24 instead of 20?... In 32 bit machine.
Advance Thanks...
#include <stdio.h>
struct temp{
char b1;
double a;
int f;
};
int main()
{
struct temp temp1;
int size = 0;
size = sizeof(temp1);
}
why size value is 24 instead of 20?... In 32 bit machine.
Advance Thanks...
struct temp{
char b1; // 1 byte + 7 bytes padding
double a; // 8 bytes
int f; // 4 bytes + 4 bytes padding
};
This is because of member padding :)