Structure vs. Union
Main DifferenceStructure and union both are user demarcated data types which contains variables of different data types. Both of them have same syntax for definition, declaration of variables and for retrieving members. Still there are many differences between structure and union. In structure every member get separate space in memory. In union, the total memory space allocated is equal to the member with biggest size. All other members share the same memory space. This is the biggest difference between structure and union.

Difference Between Structure and Union
Structure vs. Union
In structure every member get separate space in memory. In union, the total memory space allocated is equal to the member with biggest size. All other members share the same memory space. This is the biggest difference between structure and union.
Structure vs. Union
In structure we can admission any member in any sequence. Whereas in union we can access only that variable whose value is recently stored.
Structure vs. Union
All the members can be prepared while declaring the variable of structure. Only first member can be initialized while declaring the variable of union. In above example we can modify only variable roll no at the time of declaration of variable.
Structure vs. Union
Within a structure all members gets memory allocated and members have addresses that increase as the decelerators are read left-to-right. That is, the members of a structure all begin at different offsets from the base of the structure. For a union compiler allocates the memory for the largest of all members and in a union all members have offset zero from the base, the container is big enough to hold the WIDEST member, and the alignment is appropriate for all of the types in the union.
Structure vs. Union
Within a structure all members gets memory assigned; therefore any member can be retrieved at any time. While retrieving data from a union the type that is being retrieved must be the type most recently stored.
Structure vs. Union
One or more members of a structure can be initialized at once. A union may only be initialized with a value of the type of its first member; thus union u described above (during example declaration) can only be initialized with an integer value.
Structure vs. Union
The amount of memory prerequisite to store a structure variable is the sum of the size of all the members. On the other hand, in case of unions, the amount of memory required is always equal to that required by its largest member.
Structure vs. Union
With a union, you're only hypothetical to use one of the elements, because they're all stored at the same spot. This makes it useful when you want to store something that could be one of several types. A structure, on the other hand, has a separate memory location for each of its elements and they all can be used at once.
Structurenoun
A cohesive whole built up of distinct parts.
The birds had built an amazing structure out of sticks and various discarded items.Unionnoun
(countable) The act of uniting or joining two or more things into one.
Structurenoun
The underlying shape of a solid.
He studied the structure of her face.Unionnoun
(uncountable) The state of being united or joined.
Structurenoun
The overall form or organization of something.
The structure of a sentence.The structure of the society was still a mystery.Unionnoun
(countable) That which is united, or made one; something formed by a combination or coalition of parts or members; a confederation; a consolidated body; a league.
Structurenoun
A set of rules defining behaviour.
For some, the structure of school life was oppressive.Unionnoun
(countable) A trade union; a workers' union.
Structurenoun
(computing) Several pieces of data treated as a unit.
This structure contains both date and timezone information.Unionnoun
(countable) An association of students at a university for social and/or political purposes; also in some cases a debating body.
Structurenoun
Underwater terrain or objects (such as a dead tree or a submerged car) that tend to attract fish
There's lots of structure to be fished along the west shore of the lake; the impoundment submerged a town there when it was built.Unionnoun
(countable) A joint or other connection uniting parts of machinery, such as pipes.
Structurenoun
A body, such as a political party, with a cohesive purpose or outlook.
The South African leader went off to consult with the structures.Unionnoun
The set containing all of the elements of two or more sets.
Structurenoun
(logic) A set along with a collection of finitary functions and relations.
Unionnoun
(countable) The act or state of marriage.
Structureverb
(transitive) To give structure to; to arrange.
I'm trying to structure my time better so I'm not always late.I've structured the deal to limit the amount of money we can lose.Unionnoun
Sexual intercourse.
Structurenoun
a thing constructed; a complex construction or entity;
the structure consisted of a series of archesshe wore her hair in an amazing construction of whirls and ribbonsUnionnoun
A data structure that can store any of various types of item, but only one at a time.
Structurenoun
the manner of construction of something and the arrangement of its parts;
artists must study the structure of the human bodythe structure of the benzene moleculeUnionnoun
A large, high-quality pearl.
Structurenoun
the complex composition of knowledge as elements and their combinations;
his lectures have no structureUnionnoun
(historical) An affiliation of several parishes for joint support and management of their poor; also the jointly-owned workhouse.
Structurenoun
a particular complex anatomical structure;
he has good bone structureUnionverb
To combine sets using the union operation.
Structurenoun
the people in a society considered as a system organized by a characteristic pattern of relationships;
the social organization of England and America is very differentsociologists have studied the changing structure of the familyUnionnoun
an organization of employees formed to bargain with the employer;
you have to join the union in order to get a jobStructureverb
give a structure to;
I need to structure my daysUnionnoun
the United States (especially the northern states during the American Civil War);
he has visited every state in the UnionLee hoped to detach Maryland from the Unionthe North's superior resources turned the scaleUnionnoun
the act of pairing a male and female for reproductive purposes;
the casual couplings of adolescentsthe mating of some species occurs only in the springUnionnoun
the state of being joined or united or linked;
there is strength in unionUnionnoun
the state of being a married couple voluntarily joined for life (or until divorce);
a long and happy marriageGod bless this unionUnionnoun
healing process involving the growing together of the edges of a wound or the growing together of broken bones
Unionnoun
a political unit formed from previously independent people or organizations;
the Soviet UnionUnionnoun
a set containing all and only the members of two or more given sets;
let C be the union of the sets A and BUnionnoun
the occurrence of a uniting of separate parts;
lightning produced an unusual union of the metalsUnionnoun
a device on a national flag emblematic of the union of two or more sovereignties (typically in the upper inner corner)
Unionnoun
the act of making or becoming a single unit;
the union of opposing factionshe looked forward to the unification of his family for the holidaysUnionadjective
being of or having to do with the northern United States and those loyal to the Union during the Civil War;
Union soldiersFederal forcesa Federal infantrymanUnionadjective
of trade unions;
the union movementunion negotiationsa union-shop clause in the contractWhat is Structure?
Structure uses all the memory of its member. In structure we can admission any member in any sequence.
What is Union?
Union uses the largest member’s memory space. In union we can access only that variable whose value is recently stored.