using System; namespace MultiDArray { class Program { static void Main(string[] args) { //initializing 2D array int[ , ] numbers = {{2, 3}, {4, 5}}; // access first element from the first row Console.WriteLine("Element at index [0, 0] : "+numbers[0, 0]); // access first element from second row Console.WriteLine("Element at index [1, 0] : "+numbers[1, 0]); } } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter