fork download
  1. #include <iostream>
  2. using namespace std;
  3. union UniVar
  4. {
  5. char c;
  6. short s;
  7. int i;
  8. long l;
  9. float f;
  10. double d;
  11. long double ld;
  12. };
  13. int main()
  14. {
  15. cout << "sizeof(UniVar): " << sizeof(UniVar) << endl;
  16. cout << "sizeof(long double): " << sizeof(long double) << endl << endl;
  17. return 0;
  18. }
Success #stdin #stdout 0.01s 2724KB
stdin
Standard input is empty
stdout
sizeof(UniVar): 12
sizeof(long double): 12