The basic data types may have modifier preceding them to indicate special properties of the object being declared. |
|
These modifiers change the meaning of the basic data types to suit the specific needs. |
|
These modifiers are unsigned, signed, long and short. It is also possible to give these modifiers in combination, e.g., unsigned long int. |
eg:- |
Modifier for char Data Type |
|
main() |
{ |
char ch=291; |
printf("%d\t%c\n",ch,ch); |
} |
|
output:- 35 |
|
Here ch has been defined as a char ,and char cannot take a value bigger than +128.That is why assigned value of ch is 291 and is considered to be 35 (291-128-128). |
|
Data type |
Range |
Bytes occupied |
Format |
signed char |
-128 to +127 |
1 |
%c |
unsigned char |
0 to 255 |
1 |
%c |
short signed int |
-32768 to 32767 |
2 |
%d |
short unsigned int |
0 to 65535 |
2 |
%u |
long signed int |
-2147483648 to +2147483647 |
4 |
%ld |
long unsigned int |
0 to 4294967295 |
4 |
%lu |
float |
-3.4e38 to 3.4e38 |
4 |
%f |
double |
-1.7e4932 to +1.7e308 |
8 |
%lf |
long double |
-1.7e4932 to 1.7e4932 |
10 |
%lf |
|
|