For each variable consist of attach some data type.
The data type defines:
1. the amount of storage allocated to variables.
2. the values that they can accept.
3. the operations that can be performed on variables.
Data types and Related value Range -
Keyword Variable Type Range
char Character (or string) -128 to 127
int Integer -32,768 to 32,767
short Short integer -32,768 to 32,767
short int Short integer -32,768 to 32,767
long Long integer -2,147,483,648 to 2,147,483,647
unsigned char Unsigned character 0 to 255
unsigned int Unsigned integer 0 to 65,535
unsigned short Unsigned short integer 0 to 65,535
unsigned long Unsigned long integer 0 to 4,294,967,295
float Single-precision +/-3.4E10^38 to +/-3.4E10^38
floating-point
(accurate to 7 digits)
double Double-precision +/-1.7E10^308 to +/-1.7E10^308
floating-point
(accurate to 15 digits)
Signed Range Unsigned Range
char -128 to 127 unsigned char 0 to 255
int -32768 to 32,767 unsigned int 0 to 65,535
long -2,147,483,648 unsigned long 0 to 4,294,967,295 to 2,147,483,647
Get Maximum and Min value of Integer data type
Example 1.
#include
main(){
int i,j ;
i = 1;
while (i > 0) {
j = i;
i++;
}
printf ("Maximum value of integer is %d\n",j);
printf ("Min Value of integer is %d\n",i);
}
OUT PUT -
Maximum value of integer is - 2147483647
Min Value of integer is - 2147483648