Question on unions

What exactly are they used for and please help me with a few questions.
1
2
3
4
5
6
  union { //Why am I able to have no name for a union? How would you call this?
    int a;
    int b;
    int c;
}something; /*I've seen this at the end sometimes and what is this? What is its
purpose and when should I use it?*/
Last edited on
closed account (E0p9LyTq)
http://www.cplusplus.com/doc/tutorial/other_data_types/

Scroll down for the parts on Unions and Anonymous Unions.
I don't have much background, but what you're talking about appears to be called an "anoynmous union". You can also do this for structs.

http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=557
Topic archived. No new replies allowed.