The Types Program

Your mission: Extra Credit


Here are the three structures you should use:
 

struct one {
      int a;
      char b;
      double c;
};
struct two {
      char d;
      short e;
       long f;
Make up one yourself.

Here is a sample program using structures
 

#include <iostream.h>

main() {
        struct one {
                char a;
                int b;
                float c;
        };

        struct one o;
        cout << "O is " << sizeof(o) << " bytes large\n";
        cout << "O starts at " << (unsigned int)&(o) << endl;
        cout << "o.a starts at " << (unsigned int)&(o.a) << endl;
        cout << "o.a is " << sizeof(o.a) << " bytes large\n";
        cout << "o.b starts at " << (unsigned int)&(o.b) << endl;
        cout << "o.b is " << sizeof(o.b) << " bytes large\n";
        cout << "o.c starts at " << (unsigned int)&(o.c) << endl;
        cout << "o.c is " << sizeof(o.c) << " bytes large\n";
}