C# - Programming Language
This course covers the basics of programming in C#. Work your way through the videos and we'll teach you everything you need to know to start your programming journey!

2d Arrays

Lesson 22
Author : Mike Dane
Last Updated : November, 2017


Code

Copy// int [][] numberGrid = new int[2][3];
int[][] numberGrid = { new int[]{ 1, 2 }, new int[]{ 3, 4 } };

numberGrid[0][1] = 99;
Console.WriteLine(numberGrid[0][0]);
Console.WriteLine(numberGrid[0][1]);

for(int i = 0; i < numberGrid.Length; i++){
     for(int j = 0; j < numberGrid[i].Length; j++){
          Console.WriteLine(numberGrid[i][j]);
     }
}