what is the different between double and float data type in c???????? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

what is the different between double and float data type in c????????

can we use either double or float everywhere

23rd Apr 2019, 10:19 AM
Najmuddin Ansari
Najmuddin Ansari - avatar
2 Answers
+ 4
Doubles allow for greater precision.
23rd Apr 2019, 10:43 AM
Sonic
Sonic - avatar
+ 3
float: 4 bytes, single precision (8 decimals exact) double: 8 bytes, double precision (16 decimals exact) So it depends on your context. You can go with double almost everywhere. If memory is very limited (e.g. micro controllers) you may want to use float if single precision is enough for your application.
23rd Apr 2019, 10:41 AM
Matthias
Matthias - avatar