Difference between a Structure and a Union
问题 Is there any good example to give the difference between a struct and a union ? Basically I know that struct uses all the memory of its member and union uses the largest members memory space. Is there any other OS level difference? 回答1: With a union, you're only supposed to use one of the elements, because they're all stored at the same spot. This makes it useful when you want to store something that could be one of several types. A struct, on the other hand, has a separate memory location