Data types in C refer to an extensive system used for declaring variables of different types. The type of a variable determines how much space it occupies in storage and how the bit pattern stored is interpreted.
The types in C can be classified as follows −
Size Of Data Types In C
The size of each data type is defined in bits or bytes (8 bits). Each data type in C is associated with a specific range of values defined as below:
Data Type | Format Specifier | Minimal Range | Size in bit |
unsigned char | %c | 0 to 255 | 8 |
char | %c | -127 to 127 | 8 |
signed char | %c | -127 to 127 | 8 |
int | %d, %i | -32,767 to 32,767 | 16 or 32 |
unsigned int | %u | 0 to 65,535 | 16 or 32 |
signed int | %d, %i | -32,767 to 32,767 (same as int) | 16 or 32 |
short int | %hd | -32,767 to 32,767 | 16 |
unsigned short int | %hu | 0 to 65,535 | 16 |
signed short int | %hd | Same as short int | 16 |
long int | %ld, %li | -2,147,483,647 to 2,147,483,647 | 32 |
long long int | %lld, %lli | -(2^63) to (2^63)-1 | 64 |
signed long int | %ld, %li | Same as long int | 32 |
unsigned long int | %lu | 0 to 4,294,967,295 | 32 |
unsigned longlong int | %llu | (2^63)-1 | 64 |
float | %f | 1E-37 to 1E+37 along with six digits of the precisions | 32 |
double | %lf | 1E-37 to 1E+37 along with six digits of the precisions | 64 |
long double | %Lf | 1E-37 to 1E+37 along with six digits of the precisions | 80 |