fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. int main() {
  6.  
  7. struct one
  8. {
  9. int x;
  10. double y;
  11. float z;
  12. };
  13. union two
  14. {
  15. int x;
  16. double y;
  17. float z;
  18.  
  19. };
  20.  
  21. cout<<"struct size::"<<sizeof(one)<<endl;
  22. cout<<"sizeof unoin::"<<sizeof(two)<<endl;
  23. // your code goes here
  24. return 0;
  25. }
Success #stdin #stdout 0s 4360KB
stdin
Standard input is empty
stdout
struct size::24
sizeof unoin::8