+ 1
I did not understand the meaning of short and long integers
3 Respostas
+ 2
I'm not entirely sure what you mean by meaning but I will give it a try.
"short" and "long" are data types that represent integer numbers (as does "int"). They are indeed short form for writing "short int" and "long int" which is longer but states what these datatypes are more directly.
Apart from being integral data types, they differ in the range of numbers they can hold (as Egor already pointed out correctly). A "short" can only hold any number between -32768 and 32767 since it only takes up two bytes in memory.
What a "long" can hold depends on the compiler as on some architectures / compilers it's just the four bytes (32bit) the C++ standard demands and on some it's actually eight bytes (64bit).
Therefore, a "long" has at least the range of -2,147,483,648 to 2,147,483,647, if it's 32bit. For 64bit it's -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 (I can't even read the numbers). :-)
+ 1
short and long integers means that integer is having 4 bytes of memory in C++ so if we write
short int;
short makes the size of the integer half of the original size.
And if we write
long int;
long makes the size of the integer double of the original size.
short makes the integer size from 4 bytes to 2 bytes and long makes the integer size from 4 bytes to 8 bytes.
0
integer has more types short -int-long
it possesses in the space you take them