Define Unions

Unions: Unions in C and C++ are object overlays—aggregate quantities such as structs, except that each element of the union consists offset 0, and the total size of union is only as large as is required to hold its largest member (Kernighan and Ritchie 1998).

2120_unions.jpg

Unions are not supported by languages like Java. The translation has to generate different objects for the union itself and all its fields, plus the code to keep their values consistent. This results in additional overhead and can increase the state space considerably.

   Related Questions in Programming Languages

©TutorsGlobe All rights reserved 2022-2023.