C# checked and unchecked keywords

Checked and Unchecked statements are used to check the memory overflow exceptions.

The checked keyword is used to check the overflow for integral type arithmetic operations and conversations.

Overflow occurs when the value of a variable exceeds the required original length of the integral type arithmetic operations and conversations. Arithmetic overflow exceptions are raised in a checked context; whereas, in case of unchecked context, arithmetic overflow is ignored and the program displays the truncated integers from the result.

The following code snippet shows an example of checked and unchecked statements: