Int16: This Struct is used to represents 16-bit signed integer. The Int16 can store both types of values including negative and positive between the ranges of -32768 to +32767.
Example :
C#
// C# program to show the // Int16 Struct usage using System; using System.Text; publicclass GFG { // Main Method static void Main(string[] args) { // printing minimum & maximum values Console.WriteLine("Minimum value of Int16: " + Int16.MinValue); Console.WriteLine("Maximum value of Int16: " + Int16.MaxValue); Console.WriteLine(); // Int16 array Int16[] arr1 = {-3, 0, 1, 3, 7}; foreach (Int16 i in arr1) { Console.WriteLine(i); } } } |
Output:
Minimum value of Int16: -32768 Maximum value of Int16: 32767 -3 0 1 3 7
Int32: This Struct is used to represents 32-bit signed integer. The Int32 can store both types of values including negative and positive between the ranges of -2147483648 to +2147483647.
Example :
C#
// C# program to show the // Int32 struct usage using System; using System.Text; publicclass GFG { // Main Method static void Main(string[] args) { // printing minimum & maximum values Console.WriteLine("Minimum value of Int32: " + Int32.MinValue); Console.WriteLine("Maximum value of Int32: " + Int32.MaxValue); Console.WriteLine(); // Int32 array Int32[] arr1 = {-3, 0, 1, 3, 7}; foreach (Int32 i in arr1) { Console.WriteLine(i); } } } |
Output:
Minimum value of Int32: -2147483648 Maximum value of Int32: 2147483647 -3 0 1 3 7
Int64: This Struct is used to represents 64-bit signed integer. The Int64 can store both types of values including negative and positive between the ranges of -9,223,372,036,854,775,808 to +9, 223,372,036,854,775,807
Example :
C#
// C# program to show // Int64 struct usage using System; using System.Text; public class GFG { // Main Method static void Main(string[] args) { // printing minimum & maximum values Console.WriteLine("Minimum value of Int64: " + Int64.MinValue); Console.WriteLine("Maximum value of Int64: " + Int64.MaxValue); Console.WriteLine(); // Int64 array Int64[] arr1 = {-3, 0, 1, 3, 7}; foreach (Int64 i in arr1) { Console.WriteLine(i); } } } |
Output:
Minimum value of Int64: -9223372036854775808 Maximum value of Int64: 9223372036854775807 -3 0 1 3 7
Difference between Int16, Int32 and Int64 in C#
|
Sr.No |
INT16 |
INT32 |
INT64 |
|
1. |
Int16 is used to represents 16-bit signed integers. | Int32 is used to represents 32-bit signed integers . | Int64 is used to represents 64-bit signed integers. |
|
2. |
Int16 stands for signed integer. | Int32 also stands for signed integer. | Int64 also stands for signed integer. |
|
3. |
It can store negative and positive integers. | It can also store negative and positive integers. | It can also store negative and positive integers. |
|
4. |
It takes 2-bytes space in the memory. | It takes 4-bytes space in the memory. | It takes 8-bytes space in the memory. |
|
5. |
The range of Int16 is from -32768 to +32767. | The range of Int32 is from -2147483648 to +2147483647. | The range of Int64 is from -9223372036854775808 to +9223372036854775807. |
|
6. |
Syntax to declare the Int16 : Int16 variable_name; |
Syntax to declare the Int32 : Int32 variable_name; |
Syntax to declare the Int64 : Int64 variable_name; |
Recommended Posts:
- Difference between Int64 and UInt64 in C#
- C# | Buffer.BlockCopy(Array, Int32, Array, Int32, Int32) Method
- Difference between Int16 and UInt16 in C#
- Difference between Int32 and UInt32 in C#
- C# | Array.BinarySearch(Array, Int32, Int32, Object, IComparer) Method
- Array.BinarySearch(Array, Int32, Int32, Object) Method with examples in C#
- C# | Int64.ToString Method | Set - 2
- C# | Int64.ToString Method | Set - 1
- Int64.MinValue Field in C# with Examples
- Int64.GetHashCode Method in C# with Examples
- Int64.GetTypeCode Method in C# with Examples
- Int64.Equals Method in C# with Examples
- Int64.CompareTo Method in C# with Examples
- Int64.MaxValue Field in C# with Examples
- Int64.Parse(String) Method in C# with Examples
- C# | Int16 Struct
- C# | Int16.ToString Method | Set - 1
- C# | Int16.ToString Method | Set - 2
- Int16.CompareTo() Method in C#
- Int16.MinValue Field in C# with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

