write a program that illustrate union


Write a Program that illustrate union declaration?

A C program encloses the following union declaration:

union id
{
char color[12];
int size;
} shirt, blouse;

At this time we have two union variables, blouse and shirt, of type id. Each variable is able to represent either a 12-character string (color) of an integer quantity (size) at anyone time.

The 12-character string will require additional storage area within the computer's memory than the integer quantity. Consequently a block of memory large sufficient for the 12-character string will be allocated to every union variable. Thus compiler will automatically distinguish between the 12-character array and the integer quantity within the given block of memory as required.

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: write a program that illustrate union
Reference No:- TGS0305145

Expected delivery within 24 Hours