Short Integer / Int data Type

How is "short int" datatype used in C++?.


The "short int" data type is used for short integers. The signed range of the datatype is between -32768 to 32767 and the unsigned range is between 0 to 65535.

Example :

#include <iostream.h>
void main()
signed short int s = -32768;
cout << s << '\n';
cout << "Bytes used by short int is:" << sizeof(s);


Bytes used by short int is:2

In the above example, the minimum signed integer value of -"32768" is displayed, also the number of bytes used by this datatype is got using the sizeof() function.

C++ Tutorial

Ask Questions

Ask Question