Define the difference between union and structure, Computer Engineering

Assignment Help:

Define the difference between union and structure

The main difference between union and structure is the storage allocation. In Union , for each variable the compiler allocates a piece of storage that can accommodate the largestof the specified member. For example, consider the above structure is redefined as a 'union'.

union stud{

} student;

char name[15];

int regno;

char address[40];

Here the compiler allocates a storage that can accommodate 'address'. All the other variables in the structure share that location. i.e., name and reg.no values are stored in the same location where the address was stored.

But in structure each variable allocates it own storage area.

 

 


Related Discussions:- Define the difference between union and structure

Value - elements of composition, Value Value is the relative amount of ...

Value Value is the relative amount of light and darkness in an image or a particular colour within an image. Value is also known as Tone and refers to the way the artist has re

Dbms., what is cascade rollback

what is cascade rollback

Main drawbacks of cd-roms, Q. Main drawbacks of CD-ROMs? The main drawb...

Q. Main drawbacks of CD-ROMs? The main drawbacks of CD-ROMs are: It is read only thus can't be updated Access time is longer than that of magnetic disks. Very

How many bits of data will be produced if voice is converted, If voice is c...

If voice is converted to digital form using PCM, how many bits of data will be produced in half a second? While voice is converted to digital by using PCM that is Pulse Code Mo

#chemistry, Please explain the construction and working of calomel electrod...

Please explain the construction and working of calomel electrode..

Explain chaining method, Chaining: In this method, instead of hashing func...

Chaining: In this method, instead of hashing function value as location we use it as an index into an array of pointers. Every pointer access a chain that holds the element having

Information system today, What is the benefit of MITRE''s evolutionary appr...

What is the benefit of MITRE''s evolutionary approach to KM?

Prove using boolean algebra, Q. Prove using Boolean Algebra 1. AB + AC ...

Q. Prove using Boolean Algebra 1. AB + AC + BC' = AC + BC' 2. (A+B+C) (A+B'+C') (A+B+C') (A+B'+C)=A 3. (A+B) (A'+B'+C) + AB = A+B 4. A'C + A'B + AB'C + BC = C + A'B

Explain 32 to 1 multiplexer tree, Why is Multiplexer Tree needed? Draw ...

Why is Multiplexer Tree needed? Draw the block diagram of a 32:1 Multiplexer Tree and explain how input is directed to the output in this system. Ans. One of the possible

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