+ 2

Another way to display a Multidimensional Array using the indexes and understand how the rows and columns are indexed:

int[ , ] sn = {{2,3},{5,6},{4,6}}; Console.WriteLine("{0}{1}", sn[0,0],sn[0,1]); Console.WriteLine("{0}{1}", sn[1,0],sn[1,1]); Console.WriteLine("{0}{1}", sn[2,0],sn[2,1]);

9th Feb 2017, 10:55 PM
Steven Bennett
Steven Bennett - avatar
1 Answer
+ 1
int[ , ] sn = {{2,3},{5,6},{4,6}}; for (int s = 0; s < sn.Length / sn.Rank; s++) { for (int n = 0; n < sn.Rank; n++) { Console.Write(sn[s,n]); } Console.WriteLine(); } }
16th Feb 2017, 11:31 PM
Donald Green
Donald Green - avatar