+ 1

What is union?

4th Mar 2018, 4:28 PM
Puneet Bhardwaj
Puneet Bhardwaj - avatar
2 odpowiedzi
4th Mar 2018, 5:32 PM
RZK 022
RZK 022 - avatar
+ 2
is a variables container (used to make the program idealogically more understandable ) when you allocate it all the variables declared in it will be allocated in the same memory location and it will get the size of the value declared in it which is the "biggest" in number of bytes. you can access only a member per action and modifying a variable will probably modify others. PS : i suggest you to use Struct ...it's really similar and even if it allocates more than one cell of memory has more advantages than union "in my opinion".
4th Mar 2018, 5:32 PM
Alessio Bocini
Alessio Bocini - avatar