The primary use of a union is allowing access to a common location by different data types , for example hardware input/output access, bitfield and word sharing, or type punning. Unions can also provide low-level polymorphism.
In which applications union can be useful?
The primary use of a union is allowing access to a common location by different data types , for example hardware input/output access, bitfield and word sharing, or type punning. Unions can also provide low-level polymorphism.