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