So, there are two 'almost' similar structure in 'C' code
1st:
struct P1 {
int i;
char c;
char d;
int e;
};
printf("3. size of struct is, %d\n", sizeof(P1));
Gives a console Output: 3. size of struct is, 12
2nd:
struct P2 {
int i;
char c;
int e;
char d;
};
printf("4. size of struct is, %d\n", sizeof(P2));
Gives the console output: 4. size of struct is, 16
Can anyone explain the discrepancy? (Even though both the struct have 2 int and two char) Thanks in advance!