Write a program that illustrate union declaration, C/C++ Programming

Assignment Help:

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.


Related Discussions:- Write a program that illustrate union declaration

Program is to reverse the names stored in an array pointer, Program is to r...

Program is to reverse the names stored in an array pointer: Program is to reverse the 6 names stored in an array pointer as name[] void main()   {  clrscr();  char

Char, how many bytes required to char

how many bytes required to char

Define a class to model a banking system, Explain a class to model a bankin...

Explain a class to model a banking system. The function members should allow initializing the data members, a query to facilitate for account and a facility to deposit and with

Calculating interest, The interest charged on a loan banking facility is ca...

The interest charged on a loan banking facility is calculated based on principal amount, rate and time. implement a C program that can be used to automate the calculation of the in

C++ code, write c++ programm calculate electricity bill with person name,us...

write c++ programm calculate electricity bill with person name,use ,id

Assigment, C++ Programming Assignment ATM Machine Phase 1 In this assign...

C++ Programming Assignment ATM Machine Phase 1 In this assignment you will create a program that allows a user to do the following: 1) Create a bank account by supplying a use

Memory management system, 1. Basic Heap: Each memory location in our model ...

1. Basic Heap: Each memory location in our model of the RAM will be an instance of type Memory: 2. typedef union Memory_u Memory; 3. union Memory_u{ 4. char character;

Common c control flow instructions, In this Lab you will code 8086 assemble...

In this Lab you will code 8086 assembler equivalents (Virgo) for common C control flow instructions. This will give you an appreciation for how control flow is implemented in assem

#Luminous Jewels, #Byteland county is very famous for luminous jewels. Lumi...

#Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Ne

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd