Quantcast
Channel: C
Viewing all articles
Browse latest Browse all 46

Unions in C : A less used but a powerful feature of C

$
0
0
WHAT IS A UNION

A union, is a collection of variables of different types, just like a structure. However, with unions, you can only store information in one field at any one time.

You can picture a union as like a chunk of memory that is used to store variables of different types. Once a new value is assigned to a field, the existing data is wiped over with the new data.

A union can also be viewed as a variable type that can contain many different variables (like a...

Unions in C : A less used but a powerful feature of C

Viewing all articles
Browse latest Browse all 46