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

Show the features of a typical floating-point representation, Q. Show the F...

Q. Show the Features of a typical floating-point representation? The features of a typical floating-point representation of 32 bits in above figure are: Left-most bit is

Angle of elevation and depression, in building a suspension bridge a cable ...

in building a suspension bridge a cable is to be stretched from the top of a pier to a point 852.6 ft. from it''s foot. if from this point the angle of elevation of the top of the

Syntax and semantics for first-order logic , Syntax and Semanticsx and Sema...

Syntax and Semanticsx and Semantics for First-order logic - artificial intelligence: Propositional logic is limited  in its expressiveness: it may just represent true and false

Integrated services digital network service, Whole idea of ISDN is to digit...

Whole idea of ISDN is to digitize the telephone network to permit transmission of video, audio and text over existing telephone lines. The purpose of ISDN is to provide fully integ

Define hex directive, Q. Define HEX directive? HEX: HEX directive enabl...

Q. Define HEX directive? HEX: HEX directive enables the coding of hexadecimal values in body of the program. That statement directs assembler to treat tokens in source file wh

Determine flip flop the msi chip is dual edge triggered, The MSI chip 7474 ...

The MSI chip 7474 is ? Ans. MSI chip 7474 is TTL, dual edge triggered D Flip-Flop.

Binary number system using 8 bit registers, Q. Binary number system using 8...

Q. Binary number system using 8 bit registers? Add 25 and -30 in binary number system using 8 bit registers using: Signed magnitude representation Signed 1's comple

Maximum size of a database, What is the maximum size of a database that can...

What is the maximum size of a database that can be opened in Microsoft Access? Ans) 1 Gigabyte

What is redundant array of independent disks, What is Redundant Array of In...

What is Redundant Array of Independent Disks? Researchers are constantly trying to improve secondary storage media by raising their, performance, capacity as well as reliabilit

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