×
FREE ASSISTANCE FOR THE INQUISITIVE PEOPLE
Tutorial Topics
X
softetechnologies
structure and union in C - WBUT MCA 2011 - WBUT Semester I
2018    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
What makes one man great and another weak and low is shraddha (concentration).
Swami Vivekananda
443
82.66
Today So Far
Total View (Lakh)
softetechnologies
26/05/2018     54443
25/06/2018     45508
01/01/2018     43889
28/06/2017     41408
02/08/2017     40481
01/08/2017     34486
06/07/2017     34266
15/05/2017     33504
11/09/2018     30742
14/07/2017     30234
softetechnologies