To define a union, you proceed as though you were defining a structure,
except that you use the symbol union
, rather than struct
. In
the following, for example, the trade
union, as defined, contains
either of two objects: a stock_trade
object or a bond_trade
object:
union trade { struct stock_trade stock; struct bond_trade bond; };