Short Keyword


In C programming, the 'short' keyword is used to declare variables that hold integer values with a smaller range and memory footprint than 'int'.

The 'short' keyword can be used to save memory when smaller integers are sufficient for a given application.

Here's an example of using the 'short' keyword to declare a variable:


short temperature = -10;

    

In this example, the 'short' keyword is used to declare a variable named 'temperature' and initialize it with the value -10.

'short' variables are typically used when memory space is a concern, or when the range of values needed is within the smaller range supported by 'short' variables.

It's important to note that 'short' variables may have a smaller range of representable values compared to 'int'.

The exact size of 'short' can vary across different platforms and compilers. If a wider range of values is required, 'int' or 'long' should be used instead.

Loading...

Search