The difference between structure and union in C is as:

The structure in C is a data type which is user-defined that is available in C which allows combining of the data items of various kinds. Structures are generally used to represent a record.

The union in C is a special data type which is available in C that allows to store different data types in the same memory location. You can also define a union with many members but one one member of it can contain the value at one time. It also provides an efficient way to use the same memory location for different purposes.

Comments

Leave a Reply