0
struct ASDF {
    int a;
    union {
        struct {
            int aaa;
        } aa;
        struct {
            int bbb;
            int ccc;
        } bb;
        union {
            struct {
                int ddddd;
            } aaaa;
            struct {
                int eeeee;
                int fffff;
                int ggggg;
            } bbbb;
        } cc;
    } b;
};

Is this syntax OK? does it work?

Sato
  • 8,192
  • 17
  • 60
  • 115
  • Yea,it is ok. You can use this syntax with no problem. – Afshin Mar 23 '18 at 09:01
  • For the syntax part, well, just compile it and you will know it really fast. For the "is an union in an union is possible" : yes, like a structure in a structure. Is this piece of code making sense ? Dunno, I'm not in your place. – Tom's Mar 23 '18 at 09:02
  • Why don't you compile it in a standard C compiler and see for yourself? As a side note, you can now use anonymous structs/unions, in case you aren't interested in naming the nested structs/unions. – Lundin Mar 23 '18 at 09:03
  • [Here](https://stackoverflow.com/questions/22406229/nameless-union-inside-a-union) you can find more information about the unnamed unions. – QuesterDesura Mar 23 '18 at 09:05

0 Answers0