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

Salient features of direct addressing mode, Q. Salient features of direct a...

Q. Salient features of direct addressing mode? A number of salient points about this technique are: This scheme offers a limited address space since if address field has

Explain parsing, What is parsing? The target of parsing is to find out...

What is parsing? The target of parsing is to find out the syntactic validity of a source string. A tree is built for use through subsequent phase of compiler, if the string is

Explain the operation of JK flip flop when all inputs are 0, Write the trut...

Write the truth table for a clocked J-K flip-flop that is triggered by the positive-going edge of the clock signal. Explain the operation of this flip-flop for the following condit

Classify scheduler, Classify Scheduler. Scheduler is a kernel function ...

Classify Scheduler. Scheduler is a kernel function decide which method  be  thought to be implemented by the processor: the scheduler scans the list of processes in the ready s

Define various types of shift registers, What are various types of Shi...

What are various types of Shift Registers ? Ans: Kinds of Shift Registers: (i) SISO that is Serial-In Serial-Out Shift Register (ii) SIPO that is Serial-In P

Execution-modes of a multiprocessor, Q. Explain Execution-modes of a multip...

Q. Explain Execution-modes of a multiprocessor? Execution-modes of a multiprocessor: Several modes of multiprocessing comprise parallel execution of programs at (i) Fine Grain

Explain grade of service with reference to telephone traffic, With referenc...

With reference to telephone traffic, explain the terms GOS. GOS: in loss systems, the traffic carried through the network is usually lower than the actual traffic offered to

What is the use of status command, What is the use of status command, data ...

What is the use of status command, data output command, and data input command. A status command is used to test a variety of status conditions in the interface and the periphe

What is the purpose of the enableevents() method, The enableEvents() method...

The enableEvents() method is used to enable an event for a certain object. Normally, an event is enabled when a listener is added to an object for a certain event. The enableEvents

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