A C# program with an exception. | Lecture 9 - slide 16 : 30 Program 1 |
using System; class ExceptionDemo{ public static void Main(){ int[] table = new int[6]{10,11,12,13,14,15}; int idx = 6; M(table, idx); } public static void M(int[] table, int idx){ Console.WriteLine("Accessing element {0}: {1}", idx, table[idx]); } } | The source of the problem. Idx is out of the table range. The error occurs here. |