In computer programming, a short integer is a data type that can represent a whole number which may take less storage, while having a smaller range, compared with a standard integer on the same machine.
A variable defined as a short integer in one programming language may be different in size to a similarly defined variable in another. In some languages this size is fixed across platforms, while in others it is machine dependent. In some languages this datatype does not exist at all.
In C, it is denoted by short. It is required to be at least 16 bits, and is often smaller than a standard integer, but this is not required. It is often a 16-bit integer, but can be larger. A conforming program can assume that it can safely store values between −215 and 215-1, but it may not assume that the range isn't larger. In Java, a short is always a 16-bit integer. In the Windows API, the datatype SHORT is defined as a 16-bit signed integer on all machines.
Common sizes
| Programming language | Platforms | Data type name | Signedness | Storage in bytes | Minimum value | Maximum value |
|---|---|---|---|---|---|---|
| C and C++ | common implementations | short |
signed | 2 | −32,768 or −215 |
32,767 or 215 − 1 |
unsigned short |
unsigned | 2 | 0 | 65,535 or 216 − 1 |
||
| C# | .NET CLR/CTS | short |
signed | 2 | −32,768 or −215 |
32,767 or 215 − 1 |
| ushort | unsigned | 2 | 0 | 65,535 or 216 − 1 |
||
| Java | Java platform | short |
signed | 2 | −32,768 or −215 |
32,767 or 215 − 1 |
No comments have been added.





