I need a multi dimensional (Jaged Array) for entering Matrix data. Can any body telll whats wrojng with the code I have attched here...
a=new int[m][]; for(i=0;i<m;i++) { Console.WriteLine("No. Of Cols: in Raw "+(i+1)); n=Convert.ToInt32(Console.ReadLine()); for (j=0;j<n;j++) { Console.WriteLine("Enter cl: "+(j+1)); a[i][j]=Convert.ToInt32(Console.ReadLine()); } }
for( i=0;i<a.Length;i++) { for ( j=0;j<a[i].Length -1;j++) { Console.Write(a[i][j]+"\t"); } Console.WriteLine("\n"); }
}}
Error Message while executing the progrma:"Unhandled Exception: System.NullReferenceException: Object reference not set toan instance of an object. at MyArrayc2.Main()"