0

How do I know which data type to use?

I already know that boolean basically if false for numbers equal to zero, integers accepts only whole numbers (e.g. 2, 24 etc), float for floating point numbers like fractions in decimal form (eg. 5.678, 2.0 etc). What I mostly do not understand is the need and use for short, long int, long long, double, long double. I believe it has something to do with the size since int cannot store like one billion in number. Can someone explain the need for these datatypes?

30th May 2017, 9:31 AM
Chuma Umenze
5 Answers
+ 4
do you understand signed/unsigned?
30th May 2017, 9:34 AM
jay
jay - avatar
+ 3
@Chuma. Correct. They are modifiers like long and short are
30th May 2017, 10:13 AM
jay
jay - avatar
+ 1
unsigned has to do with positive values while signed has to do with both positive and negative. signed int x = 1; is same as int x = 1; am I correct?
30th May 2017, 9:44 AM
Chuma Umenze
0
@Luka int or signed int can only store values from -2147483648 to 2147483647. My question is how are these values gotten? and how do I know which data type to implement?
30th May 2017, 10:18 AM
Chuma Umenze