struct student
{
char a;
char b;
char c;
char d;
int e;
};
struct student1;
{
char a;
int b;
char c;
}
:
____________________
|char|char|char|char| // one byte for each char so there is no slack=4byte
|____|____|____|____|
____________________
|int | * | * |* | // int takes for byte;=4byte total space is 4+4=8;
|____|____|____|____|
student1 :
____________________
|char| s |s | s | // one byte for char
|____|____|____|____| // s indicates a slack byte..=4byte
____________________
|int |* |* |* | //int takes four bytes;=4byte
|____|____|____|____|
___________________
|char| s |s | s | // one byte for char
|____|____|____|____| // s indicates a slack byte..=4byte