DEV Community

Nick
Nick

Posted on

What Is Short keyword In C#

The "short" keyword in C# is a data type used to declare integers that occupy less memory space compared to the default "int" data type.

A "short" variable can hold integer values ranging from -32,768 to 32,767, covering a smaller range compared to "int" (which can hold values from -2,147,483,648 to 2,147,483,647).

Using the "short" data type can be beneficial when memory space is a concern, especially in scenarios where a large number of variables need to be stored.

However, it is important to note that using "short" may sacrifice the range of numbers that can be stored, so it should be used judiciously based on the requirements of the program.

Top comments (0)