sizeof operator

  1. You learned many data types in Chapter 2:
    1. int, unsigned int
    2. char, unsigned char
    3. short, unsigned short
    4. long
    5. long long
    6. bool
    7. float
    8. double
  2. Use the sizeof operator to show the size of these data types, respectively. That is, how many bytes will be occupied by each data type?

The program may run as follows. (Note that the size of "long" may differ, dependong on whether your program is running on a 32-bit or a 64-bit machine.)
The size of 'int' is 4
The size of 'unsigned int' is 4
The size of 'char' is 1
The size of 'unsigned char' is 1
The size of 'short' is 2
The size of 'unsigned short' is 2
The size of 'long' is 8
The size of 'unsigned long' is 8
The size of 'long long' is 8
The size of 'bool' is 1
The size of 'float' is 4
The size of 'double' is 8