+ 7
Why is the output 100 100?
#include <stdio.h> int main() { union{ int i1; int i2; }myVar={.i2=100}; printf("%d %d",myVar.i1,myVar.i2); return 0; }
2 Respostas
+ 2
Unions store all of their variables in the same place without offsets.
#include <stdio.h> int main() { union{ int i1; int i2; }myVar={.i2=100}; printf("%d %d",myVar.i1,myVar.i2); return 0; }