Guidelines and tips for mixing up C structure and union.
I understood that struct and union are used to group data as a pack, with an exception that union stores its member values all in the same address in memory. I would like to know more about these data structures, so please share anything you know about them that I haven't mentioned. Differences, strengths and/or weaknesses, usage preferences etc. My first question is about mixing the two data structures, e.g. a struct inside a union, or a union inside a struct. Tell me when/why would/should we do that (mixing them up)? How (or in which situation) do we decide which should be inside the other, and what are the points to notice, the DOs and DON'Ts. Second question is about anonym struct or union and/or mix of the two. What/when/why the need to use these? what are the benefits (if any) over the use of named struct or union? Third question is, what difference between C and C++ union. I understand the difference between C and C++ struct, so it's okay đ Thanks in advance, đ