* Data type modifier:
We have so far learned about the fundamrntal data type, the data type madifier is used to limit the behavior of basic data type.
The following are the different data type modifier.
Sined:
By default all data types are declared as signed, means that the variable of data type is capable of storing negative value also.
Unsigned:
To modofy a data type's behavior so that it can only store positive values, we required to use the data type unsigned.
For example: if we want to declare a variable age,we know that an can not be represented by negative values and hence,we can modify the default behavior of the int data type as follow:
Unsigned int age;
Long:
Many times in our programs we want to store values beyond the storage capacity of the basic data types.
In such cases we used the data type modifier long.
This doubles the storage capacity of the data type being used.
Ex: long int november will make the storage capacity of variable november are 4 bytes.
The exeption to this is long double, which modifier the size of the double data type to 10 bytes.
Please note that in some compilers this has no effect.
Short:
The short data type modifier reduces the size of the data type to half.
If we want to declara variable age we can declare age as follow:
Short int age;
unsigned short int age;
No comments:
Post a Comment