0
Output question
union Data{ int one;int two; }; int main() { union Data t; t.one=5; t.two=3; printf("%d\n", t.one); return 0; } Why is the output 3? Reason please?
5 Respuestas
+ 3
unions use the same memory address for each value in it. And only one can be at the address at a time.
+ 2
Wichever one you put in last is what matters. Its the value at the memory address that you call.
+ 1
Ok thanks I will read it in detail 👍
0
But t.one value is 5so ans should be 5
0
And it is union so I think that it comes with the biggest member