Article

Chapter-14(Difference- and-similarities-between-Structure-Union)


Similarities between Structure and Union:

1. Both are the collection of any type of data.

2. Both require an object name or a variable name for memory allocation.

3. Both use the dot operator to access the member of the collection.

Difference Between Structure and Union:

                                                                   Structure                                                                                          Union

1. keyword                                          struct                                                                                                  union

2.Memory allocation                    contineous memory space to each element                  only to greatest element

3. Memory Space                            more memory space                                                                     Less memory space

4. Members data Storage            At their own location                                                                    At a single location.