float
and double
are used to hold real numbers.
float salary;
double price;
In C, floating-point numbers can also be represented in exponential. For example,
float normalizationFactor = 22.442e2;
What’s the difference between float
and double
?
The size of float
(single precision float data type) is 4 bytes. And the size of double
(double precision float data type) is 8 bytes.