What is the benefit of union? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the benefit of union?

Why union? Is the same memory location matter?

30th Jul 2020, 2:08 PM
Md. Mezbaul Islam Zion
Md. Mezbaul Islam Zion - avatar
3 Answers
+ 8
Please give us a code sample of what you are talking about. You should also name the programming language in a tag. Thanks!
30th Jul 2020, 2:14 PM
Lothar
Lothar - avatar
+ 2
Pls Tag language also.. Unions are used for efficient memory utilization when compare to structs in c... This ma help you more.. https://stackoverflow.com/questions/252552/why-do-we-need-c-unions
30th Jul 2020, 2:38 PM
Jayakrishna 🇮🇳
+ 1
it helps u to store different datatypes in the same memmory location.
30th Jul 2020, 3:51 PM
Ambati Veda priya
Ambati Veda priya - avatar