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 speculative execution, Define speculative execution. Speculative...

Define speculative execution. Speculative execution means that instructions are implemented before the processor is particular that they are in the correct execution sequence.

Explain the working of a 1-to-16 Demultiplexer, Using a suitable logic diag...

Using a suitable logic diagram explain the working of a 1-to-16 de multiplexer. Ans. 1-to-16 Demultiplexer Working: A demultiplexer obtains in data from one line and directs this

Avoiding over fitting in decision trees, A v o iding Over fitting - Arti...

A v o iding Over fitting - Artificial intelligence As  we  discussed  in  the last  lecture,  over fitting  is  a  normal  problem  in machine learning. Decision trees suffe

Explain the raster scan monitors, Explain the raster scan monitors The ...

Explain the raster scan monitors The refresh process must also be performed for raster scan monitors. Most television monitors are raster scan display devices : one scan-line a

What are the steps to design algorithm, What are the steps to design algori...

What are the steps to design algorithm? Formulate algorithm for each operation. Analysis specification tells what the operation does. The algorithm shows how it is done. The st

Best method between linear and matrix addressing modes, Which of the best m...

Which of the best method between linear addressing and matrix addressing modes ? Ans: Best Method: Matrix Addressing is the suitable method, since this configuration on

Explain priority encoder with an example, Explain Priority encoder with an ...

Explain Priority encoder with an example. Ans. Priority encoder- Basically an encoder is a combinational circuit which performs the inverse operation of a decoder. The inp

Explain congestion, Explain CONGESTION. CONGESTION: This is uneconomi...

Explain CONGESTION. CONGESTION: This is uneconomic to provide sufficient equipment to carry entire traffic that could possibly be given to a telecommunication system. Inside

Name the numerous household devices, Name the Numerous household devices ...

Name the Numerous household devices Numerous household devices now use microprocessors to control their different functions. The following is just a sample of common devices (d

Solution of multi-layer ann with sigmoid units, Solution of multi-layer ann...

Solution of multi-layer ann with sigmoid units: Assume here that we input the values 10, 30, 20 with the three input units and from top to bottom. So after then the weighted s

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