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

Compare memory mapped i/o with i/o mapped i/o, Compare memory mapped I/O wi...

Compare memory mapped I/O with I/O mapped I/O. Memory Mapped I/O Scheme: In this scheme there is only one address space. Address space is stated as all possible addresses tha

Programming a 64-bit processor, You are to write a C program called big_mul...

You are to write a C program called big_mult.c that multiplies two unsigned 64-bit integers, x and y, read from the command line. The output is a pair of unsigned 64-bit integers r

State the implementation of a security policy, State the implementation of ...

State the implementation of a security policy The implementation of a security policy should invariably cover all parameters of security such as physical access to the server,

What is roll area, What is roll area? A roll area having the program's...

What is roll area? A roll area having the program's runtime context.  In addition to the runtime stack and other structures, all local variables and any data known to the prog

What is computer to computer communication, Computer to computer communicat...

Computer to computer communication is: (A)  Simplex                                   (B)  Duplex (C)  Half Duplex                             (D)  Both Duplex and Half D

Create an input buffer, Q. Create an input buffer ? CODE SEGMENT ......

Q. Create an input buffer ? CODE SEGMENT ... MOV AH, 0AH                       ; Move 04 to AH register MOV DX, BUFF                   ; BUFF must be defined in data

Explain about the term intranet in brief, Explain about the term Intranet i...

Explain about the term Intranet in brief. Intranet: An Intranet is a form of information system which facilitates communication into the organizations in between widely

Programming project, l need a help for my project pllz:) Write a program th...

l need a help for my project pllz:) Write a program that will simulate ATM machine. The Program should prompt the user to enter a valid PIN password number of 5 digits (PIN: 12312)

List one advantage & disadvantage of having large block size, List one adva...

List one advantage and one disadvantage of having large block size. Ans: Advantage: By using a huge block of memory is maximum process's accommodation that resulting is less no

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