Modifying data types means:
- Increasing or decreasing the default range of the data type, basically requesting compiler to allocate more or less memory than the default memory of the data type.
- what to do with the left most significant bit – use to store positive or negative sign ? or use to store the value itself ?
What to use when:
- Required to store lesser number than integer (but, some compilers use same size of memory for both “short” and “int”) ? Use “short”.
- Required to store a normal integer value ? Use “int”.
- Required to store larger number than integer / double ? Use “long”.
- Required to store much larger number than integer or long integer ? Use “long long”.
- Required to store a number or with a positive or negative sign ? Use “signed”.
- Required to store a character only with in a range of ASCII (0 to 127) ? Use “signed”.
- Required to store a number without any sign (left most significant bit will also be used to store value, so the range will be more and can accommodate larger value than “signed”) ? Use “unsigned”.
- Required to store a character with in an extended range of ASCII (0 to 255) ? Use “unsigned”.
- signed: applicable for character and integer data types
- unsigned: applicable for character and integer data types
- short: applicable for integer
- long: applicable for integer and double