What Is Short int In C Programming?

Data Types

A C language program manipulates data to give the desired output. Data can be categorized according to their use. Different categories of data require different CPU clock cycles to be processed. Integer data types are processed at the fastest rate as compared to other data types.

An integer is one of the basic data types. Integer has a range from -32768 to 32768. An integer consumes 2 bytes in memory, an integer data type can be subdivided into short int, int, and long int. Short int. Int and long int have different ranges to store values.

short int

To store a small number in memory a short int is used. The memory consumed by short int to hold numeric value depends on the hardware and operating system.

short int or unsigned short int consume two bytes in memory and have the range of 0 to 255. Signed short int consumes 2 bytes in memory and have the range of -128 to 127.  

Signed short int can store positive or negative values.