When would you use an int vs. a double in creating a variable? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

When would you use an int vs. a double in creating a variable?

29th Jan 2019, 11:24 PM
Yesenia Silva
2 Antworten
0
common uses for an int is to iterate through something as a loop control variable. A double is a real number and is more precise than float though precision can still be an issue with a double when representing currency as a double.
30th Jan 2019, 1:21 AM
25tunez
25tunez - avatar
+ 1
int is an integer of 4 bytes of memory (cpp standard) double is a real number of 8 bytes so it is for you to choose what you need
29th Jan 2019, 11:49 PM
medidou
medidou - avatar