+ 1
What is the the difference between structure and union in C programming?
2 odpowiedzi
+ 5
A struct stores all the values you assign to it, while a union shares the same memory space for all values, correctly saving only the last assigned value.
I don't know if I explained myself well... 🤔
https://www.sololearn.com/Course/C/2944/?ref=app
+ 3
Tag the language you're using(C programming) and not your name.
A structure is a collection data type where you can have a bunch of variables collectively under a single data type that's defined by you.
Ex: https://code.sololearn.com/cSUFFYB7Bwx6/?ref=app
A union in C, is similar to structures, but you can only use one variable at a time here.
Ex: https://code.sololearn.com/ccVW7A3Ai56a/?ref=app