+ 1
What are some real life problems where unions and structure data types in c are used?
What would the real case scenario apart from data management where we can classify the use of structures and unions
1 Réponse
+ 1
Everywhere in modern C.
The structures that you see in textbooks on C are just for old times sake now. Modern C almost always uses structures and unions and in my experience I haven't seen a C code after C99 that doesn't use a structure atleast for some cases.
Structures and Unions can also have thier respective holder predicates and function pointers which can be used to generate loose bound classes.
Most of the Standard Libraries of C11 don't use just plain C data types anymore, they use structures and unions which are cast to a name.
Examples can be : uint16_t, int64, wchar_t, etc.