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

Explain implementation techniques, Explain Implementation techniques Im...

Explain Implementation techniques Implementation techniques(e.g. remote invocation, HTTP). An event-based cooperation can be executed using message passing or it can  be based

What is response ratio, What is response ratio? HRRN that is Highest Re...

What is response ratio? HRRN that is Highest Response Ratio Next scheduling is a non-preemptive discipline, as same to Shortest Job First (SJF) wherein the priority of all jobs

Explain traditional computer clusters, Q. Explain traditional computer clus...

Q. Explain traditional computer clusters? Grid computing employs resources of a lot of separate computers linked by a network (generally internet) to resolve large-scale comput

What are the disadvantages of a smart card, What are the disadvantages of a...

What are the disadvantages of a Smart Card? Disadvantages of Smart Cards are as follows: a. The value of money can be depleted and recharged. b. Customers should keep

Basic of C, write algorithm and draw flowchart for exchange the values of t...

write algorithm and draw flowchart for exchange the values of two variables.

Explain crossbar exchange with all call processing steps, Explain crossbar ...

Explain crossbar exchange, with all call processing steps and diagrams. The fundamental idea of crossbar switching is to give a matrix of n x m sets of contacts with only n + m

What is strong-typing versus weak-typing, What is strong-typing versus weak...

What is strong-typing versus weak-typing? Which is preferred? Why? Strong type is checking the types of variables as early as possible, usually at compile time. Whereas weak ty

Declare abstract processor arrays, Think about call of two intrinsic functi...

Think about call of two intrinsic functions discussed above for a 32-Processor (4×8) Multicomputer:    The function call NUMBER_OF_PROCESORS () will return 32.

Define electronic data interchange, Electronic Data Interchange (EDI ) is u...

Electronic Data Interchange (EDI ) is used by companies for transactions that happen on regular basis to a pre-determined format. It is one of the electronic commerce technologies.

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