I'm very confused by the whole 'data alignment' thing:
#include <stdio.h>
int main(){
    struct st{
        int i,*p;
        char c;
        union { char type[4]; unsigned char d;} un; 
    };
    struct st s1={25,&a,'X',"asdf"};
    printf("sizeof s1 is %d",sizeof(s1));
    return 0;
}
due to data alignment, i thought that since the sizes of
int i : 4 bytes
int *p : 8 bytes
char c : 1 byte(+3)
union : 4 bytes
the output would be 20, but this outputs sizeof s1 is 24!
Why is it outputting 24? Does this regard int *p, which is 8 bytes?
 
     
     
    