You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
448 B
C#
24 lines
448 B
C#
5 years ago
|
/*
|
||
|
* C# Program to Demonstrate Exception Handling for Stack Overflow
|
||
|
*/
|
||
|
using System;
|
||
|
class Program
|
||
|
{
|
||
|
static void excep(int value)
|
||
|
{
|
||
|
Console.WriteLine(value);
|
||
|
excep(++value);
|
||
|
}
|
||
|
|
||
|
static void Main()
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
excep(0);
|
||
|
}
|
||
|
catch (StackOverflowException e)
|
||
|
{
|
||
|
Console.WriteLine(e.Message);
|
||
|
}
|
||
|
}
|
||
|
}
|