Unions
Fields that share the same memory — only one is valid at a time.
Easy
Used for variant types (with a tag field) and viewing raw bytes of a value. Reading a different member than written is allowed in C (type punning), unlike C++.
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.