Advertisement
xathrya

Setruk setruk struct!

Dec 10th, 2013
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct A
  5. {
  6.     char c;
  7.     short s;
  8. };
  9.  
  10. struct B
  11. {
  12.     short s;
  13.     char c;
  14.     int i;
  15. };
  16.  
  17.  
  18. struct C
  19. {
  20.     char c;
  21.     double d;
  22.     int i;
  23. };
  24.  
  25. struct D
  26. {
  27.     double d;
  28.     int i;
  29.     char c;
  30. };
  31.  
  32. int main()
  33. {
  34.     cout << "The sizeof A is: " << sizeof(A) << endl;
  35.     cout << "The sizeof B is: " << sizeof(B) << endl;
  36.     cout << "The sizeof C is: " << sizeof(C) << endl;
  37.     cout << "The sizeof D is: " << sizeof(D) << endl;
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement