| Previous | Home | Next |
Floats and doubles
A float occupies four bytes in memory and can range from -3.4e38 to +3.4e38.
If this is insufficient then C offers a double data type that occupies 8 bytes in memory and has a range from -1.7e308 to +1.7e308. A variable of type double can be declared as:
double a, population ;
If the situation demands usage of real numbers that lie even beyond the range offered by double data type, then there exists along double that can range from -1.7e4932 to +1.7e4932.
A long double occupies 10 bytes in memory.
Some of the data types are given below with their range and how much space they required:
| Data Types | Range | Bytes | 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 |
| signed int | -32768 to +32767 | 2 | %d |
| 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.7e308 to +1.7e308 | 8 | %lf |
| long double | -1.7e4932 to +1.7e4932 | 10 | %lf |
| Previous | Home | Next |