fork(2) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct A {
  5. union {
  6. struct {
  7. double xyz[3];
  8. };
  9. double x, y, z;
  10. };
  11. };
  12.  
  13. int main()
  14. {
  15. A a;
  16. a.xyz[0] = 1.5;
  17. a.xyz[1] = 2.12;
  18. a.xyz[2] = 3.14;
  19.  
  20. cout << a.x << endl << a.y << endl << a.z << endl;
  21. }
  22.  
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
1.5
1.5
1.5