Given a means to define structure templates, to name and allocate storage space for structures, and to access the members of structures, all of the facilities necessary for the definition and access of unions are in place. The reason for this is that a union is nothing more than a structure all of whose members are superimposed in storage. That is, while the offset from the structure’s origin, of each successive member of a structure, increases monotonically (i.e., the first member has zero offset; the second member begins at an appropriate point just beyond where the first member ends; and so on), the offset of every union member is the same, namely, zero.
Unable to display preview. Download preview PDF.