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

difference among primary and secondary storage device, In primary storage ...

In primary storage device the storage capacity is fixed. It has a volatile memory. In secondary storage device the storage capacity is not limited. It is a nonvolatile memory. Prim

What is a co-processor, What is a co-processor? What is its use in a typica...

What is a co-processor? What is its use in a typical microprocessor based system. 8087 NDP (numerical data processor) is also called math co-processor which is used in parallel

Name the two operations of stack, Name the two operations of stack A st...

Name the two operations of stack A stack has only two operations and they are insertion and deletion of items. The operation insertion is called push (or push-down) as it can b

Assembly langaauge microprocessor, write alp to perform bcd addition withou...

write alp to perform bcd addition without using procedure

Quantifiers and variables - propositional model, Quantifiers and Variables ...

Quantifiers and Variables - propositional model: There is one question is arrives that 'What do sentences containing variables mean?' In other way of words, how does a first-o

What is tape backup, Q. What is Tape Backup? Magnetic tapes are used th...

Q. What is Tape Backup? Magnetic tapes are used these days in computers for the below purposes: Backing up data stored in disks. It is essential to regularly save data s

What is memory mapped i/o, What is memory mapped I/O? When the I/O devi...

What is memory mapped I/O? When the I/O devices share the similar address space, the arrangement is known as memory mapped I/O.

What is the difference between thread and process, What is the difference b...

What is the difference between thread and process?  Thread - is used to execute more than one program at a time. process - executes single program A thread is a path of e

Define rules for reducing karnaugh maps, Define Rules for Reducing Karnaugh...

Define Rules for Reducing Karnaugh Maps? The rules for reducing Karnaugh Maps (k- maps) are as follows: All of the 1's in the Karnaugh Map are called as minterms. The

Why do we call motherboard a motherboard, Motherboard is called as motherbo...

Motherboard is called as motherboard because in the world all borned creature is directly attached to her mother & after it all the relations makes due to her mother so in the simi

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