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

Define far and near procedures, Q. Define Far and Near Procedures? Proc...

Q. Define Far and Near Procedures? Procedure offers the primary means of breaking the code in a program into modules. Procedures have one maindrawbackwhich is they need extra c

Explain the term- looking at existing paperwork, Explain the term- Looking ...

Explain the term- Looking at existing paperwork This allows analyst to see how paper files are kept and look at operating instructions and check accounts, training manuals etc

Bubbling the pipeline - computer architecture, Bubbling the Pipeline: B...

Bubbling the Pipeline: Bubbling the pipeline (also known as a pipeline break or pipeline stall) is a technique for preventing, structural, data and branch hazards from taking p

Discuss primary elements of supply chain management models, Discuss the pri...

Discuss the primary elements of Supply Chain Management models. Primary Elements of Supply Chain Management Models are discussed in below: They are fundamentally concerned a

Describe about the layered computer design, Describe about the Layered comp...

Describe about the Layered computer design Introduction Layered computer design focuses on computer design. It uses top-down, layered approach to design and also to improve

Other equivalences, Equivalences: In this following miscellaneous equi...

Equivalences: In this following miscellaneous equivalence rules are often useful during rewriting sessions. So there the first two allow us to completely get rid of implicatio

What is problem statement, What is problem statement The problem state...

What is problem statement The problem statement is crucial for any analysis. Problem statement is general description of the user's desires, and difficulties. The motive of pr

Structured analysis and design approach, Q. Structured Analysis and Design ...

Q. Structured Analysis and Design Approach? The objective of structured system analysis and design is to reduce maintenance time as well as effort. Modeling is the act of drawi

Explain about distributed systems, Q. Explain about distributed systems? ...

Q. Explain about distributed systems? A Distributed System in that Data, Process and Interface component of information System are distributed to many locations in a computer n

ip address and port number at the remote host, How many TCP connections ar...

How many TCP connections are in the "Established" state? Contain relevant output. For one of the established TCP connections, what are the IP address and port number at the remote

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