Integer overflow

suggest change

There is a maximum capacity an integer can store. And when you go over that limit, it will loop back to the negative side. For int, it is 2147483647

int x = int.MaxValue;                //MaxValue is 2147483647
x = unchecked(x + 1);                //make operation explicitly unchecked so that the example also works when the check for arithmetic overflow/underflow is enabled in the project settings 
Console.WriteLine(x);                //Will print -2147483648
Console.WriteLine(int.MinValue);     //Same as Min value

For any integers out of this range use namespace System.Numerics which has datatype BigInteger. Check below link for more information https://msdn.microsoft.com/en-us/library/system.numerics.biginteger(v=vs.110).aspx

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Overflow:
* Integer overflow

Table Of Contents
17 Regex
19 Arrays
21 Enum
22 Tuples
24 GUID
27 Looping
36 Casting
46 Methods
79 Overflow
88 Events
92 Structs
104 Indexer
106 Stream
107 Timers
109 Threading
127 Caching
135 Pointers
147 C# Script