×
FREE ASSISTANCE FOR THE INQUISITIVE PEOPLE
Tutorial Topics
X
softetechnologies
structure and union in C - WBUT MCA 2011 - WBUT Semester I
1070    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
Education is the manifestation of the perfection already in man.
Swami Vivekananda
28612
52.78
Today So Far
Total View (Lakh)
softetechnologies
26/05/2018     42032
01/01/2018     36003
28/06/2017     34089
25/06/2018     33448
02/08/2017     32401
01/08/2017     26868
06/07/2017     26791
15/05/2017     26418
14/07/2017     21855
21/04/2018     20717
softetechnologies