[ create a new paste ] login | about

Link: http://codepad.org/xWbrGP1g    [ raw code | output | fork ]

C, pasted on Feb 20:
struct MyStruct
    {
        unsigned char a : 6;
        union
        {
            struct
            {
                unsigned int b : 9;
            };
        };
    };
struct MyStruct2
    {
        unsigned char a : 6;
            struct
            {
                unsigned int b : 9;
            };
    };
struct MyStruct3
    {
        unsigned char a : 6;
                unsigned int b : 9;
    };

struct MyStruct4
    {
        unsigned char a : 6;
        union {unsigned int b : 9;};
    };
int main() {
printf("%d\n", sizeof(struct MyStruct));
printf("%d\n", sizeof(struct MyStruct2));
printf("%d\n", sizeof(struct MyStruct3));
printf("%d\n", sizeof(struct MyStruct4));
printf("%d\n", sizeof(int));
return 0;
}


Output:
1
2
3
4
5
8
8
4
8
4


Create a new paste based on this one


Comments: