Related Articles
Difference between Int64 and UInt64 in C#
• Last Updated : 26 May, 2020

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 the ` `// difference between Int64 ` `// and UInt64 ` ` `  `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
```

UInt64: This Struct is used to represents 64-bit unsigned integer. The UInt64 can store only positive value only which ranges from 0 to 18,446,744,073,709,551,615.

Example :

## C#

 `// C# program to show the  ` `// difference between Int64  ` `// and UInt64 ` ` `  `using` `System; ` `using` `System.Text; ` ` `  `public` `class` `GFG{ ` `     `  `    ``// Main Method ` `    ``static` `void` `Main(``string``[] args) ` `    ``{ ` ` `  `        ``//printing minimum & maximum values ` `        ``Console.WriteLine(``"Minimum value of UInt64: "` `                          ``+ UInt64.MinValue); ` `        ``Console.WriteLine(``"Maximum value of UInt64: "` `                          ``+ UInt64.MaxValue); ` `        ``Console.WriteLine(); ` `         `  `        ``//Int64 array ` `        ``UInt64[] arr1 = { 13, 0, 1, 3, 7}; ` `         `  `        ``foreach` `(UInt64 i ``in` `arr1) ` `        ``{ ` `            ``Console.WriteLine(i); ` `        ``} ` `    ``} ` `}`

Output:

```Minimum value of UInt64: 0
Maximum value of UInt64: 18446744073709551615

13
0
1
3
7
```

Differences between Int64 and UInt64 in C#

My Personal Notes arrow_drop_up
Recommended Articles
Page :