What is the main difference between STRUCTURE and UNION?

Answer Posted / asesh k tripathy

The difference between union and structure can be as follows:
1. The way structure occupies memory for its member is different from union.
(a) Structure occupies appropriate separate memory for its members
(b) Union occupies memory for that member which needs largest chunk of bytes.
2. We can initialize any of the structure members while initializing any of the union member other than the first member may have unpredictable results.

Is This Answer Correct ?    57 Yes 21 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Set up procedure for generating a wire frame display of a polyhedron with the hidden edges of the object drawn with dashed lines

3048


write a program for area of circumference of shapes

2050


Given a spherical surface, write bump-mapping procedure to generate the bumpy surface of an orange

2876


To Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates. String contains only lowercase characters ['a'-'z']

518


how to programme using switch statements and fuctions, a programme that will output two even numbers, two odd numbers and two prime numbers of the users chioce.

2157






how to create a 3x3 two dimensional array that will give you the sums on the left and bottom columns

3144


What is the match merge ? compare data step match merge with proc sql merge - how many types are there ? data step vs proc sql

2423


How can you relate the function with the structure? Explain with an appropriate example.

2932


Sir... please give some important coding questions asked by product companies..

1815


Cluster head selection in Wireless Sensor Network using C programming language.

3136


could you please send the program code for multiplying sparse matrix in c????

3089


Write a program to model an exploding firecracker in the xy plane using a particle system

3709


why nlogn is the lower limit of any sort algorithm?

2394


Design an implement of the inputs functions for event mode

2976


Can you send Code for Run Length Encoding Of BMP Image in C Language in linux(i.e Compression and Decompression) ?

3874