0
In which cases should we use int,float, double,long...?
2 Answers
+ 2
It depends on the size of the value you need. Also precision for floats and doubles. In the language of your choice run a sizeof on each data type to see how may bytes each can handle.
8 bits to a byte each bit is equal to 2^n where n is the index of the bit. You can calculate the max number available for that data type.
For signed numbers (ie negative and positive values) one of the bits is used as a FLAG to indicate negative or positive value, hence the scope of minimum and maximum values change.
Some items require a certain number of bits like address locations so you have to know what data type can fit that data.
This link explains it better and gives a table so you can see the byte sizes and value scope.
https://discover.hubpages.com/technology/Data-Types-in-C-Language
*Other languages have different bit sizes for their data types.
+ 1
In which language?!