×
FREE ASSISTANCE FOR THE INQUISITIVE PEOPLE
Tutorial Topics
X
softetechnologies
structure and union in C - WBUT MCA 2011 - WBUT Semester I
1318    Arnab De    11/12/2019

Compare and contrast between structure and union in C. [WBUT MCA 2011]

Both structure and union are the ADT or Abstract Data Type in C which are bind the one or more different types of data variables within a scope. Those variables are accessed by the corresponding structure or union variables. But there is a simple difference between them.

softetechnologies

Structure can use all the variables within it. I.e. it can store or access the said variables in it at a time. Structure allocates separate memory for each of the variables declared in it. It allocates more memory than union. We declared a structure using the keyword “struct”.

softetechnologies

But in union only one variable of any type can access at a time. It occupies a smaller memory space than a structure. It occupies the same quantity of memory which occupies the largest variable, declared within it. To declare a union, we use the keyword “union”.

softetechnologies
Author Details
Arnab De
I have over 16 years of experience working as an IT professional, ranging from teaching at my own institute to being a computer faculty at different leading institute across Kolkata. I also work as a web developer and designer, having worked for renowned companies and brand. Through tutorialathome, I wish to share my years of knowledge with the readers.
Enter New Comment
Comment History
No Comment Found Yet.
Swami Vivekananda
A nation is advanced in proportion to education and intelligence spread among the masses.
Swami Vivekananda
1230
60.61
Today So Far
Total View (Lakh)
softetechnologies
26/05/2018     44721
01/01/2018     36882
25/06/2018     36855
28/06/2017     34896
02/08/2017     33492
01/08/2017     27840
06/07/2017     27613
15/05/2017     27180
14/07/2017     22943
11/09/2018     21679
softetechnologies