Anonymous Union

suggest change

The members of an anonymous union belong to the scope containing the union declaration and must not conflict with other names in that scope. This construction resembles the struct in Anonymous Members, but is standard-conforming.

struct Sample {
    union {
        int a;
        int b;
    };
    int c;
};
int main()
{
  Sample sa;
  sa.a =3;
  sa.b =4;
  sa.c =5;
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents