A quick question | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 3

A quick question

Can we use double for everything we use? Numbers, texts and stuff. If not, why do we have int for whole numbers as we can use double for them?

3rd Jun 2018, 1:45 PM
Icefield
Icefield - avatar
3 Respostas
+ 5
A double can only store a floating point number value, though some languages like C might not really care, what you actually do with the variable. The reason why we still use int values is, that 1. you need floating point values rather seldom and 2. they would waste memory and other resources for unnecessary accuracy if they where default.
3rd Jun 2018, 1:54 PM
Aaron Eberhardt
Aaron Eberhardt - avatar
+ 3
You're welcome :)
3rd Jun 2018, 1:59 PM
Aaron Eberhardt
Aaron Eberhardt - avatar
+ 2
Thanks so much, sorry I am new.
3rd Jun 2018, 1:57 PM
Icefield
Icefield - avatar