0
What is the difference between signed long int variable* & signed short int variable*?
c++ data types (i'm talking about the long and short thing) THANKS!
1 Réponse
+ 10
A short is 2 bytes, containing values from -32,768 to 32,767.
A long is 4 bytes containing values from –2,147,483,648 to 2,147,483,647
A long long is 8 bytes containing values from –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.
signed basically means it can be negative. So an 'unsigned' datatype uses the extra '1/0' (in binary) to be able to handle larger positive numbers.
So a unsigned short can contain values from 0 to 65,535.
If you're never dealing with negatives, might as well use an unsigned data type.
https://msdn.microsoft.com/en-us/library/s3f49ktz.aspx