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?
5 Answers
+ 4
do you understand signed/unsigned?
+ 3
@Chuma. Correct. They are modifiers like long and short are
+ 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?
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?