illustrates the use of a two-dimensional rectangular array : Array Dimension : Collections Data Structure C# Source Code


Custom Search

C# Source Code » Collections Data Structure » Array Dimension »

 

illustrates the use of a two-dimensional rectangular array









    

/*
  illustrates the use of a two-dimensional rectangular array
*/

using System;

public class Example10_6 {

  public static void Main()  {
    const int rows = 8;
    const int columns = 8;
    string[,] chessboard = new string[rows, columns];

    chessboard[0, 0] = "White Rook";
    chessboard[1, 0] = "White Pawn";
    chessboard[2, 3] = "White King";
    chessboard[3, 5] = "Black Bishop";
    chessboard[4, 4] = "Black Pawn";
    chessboard[5, 3] = "Black King";

    for (int row = 0; row < rows; row++)
    {
      for (int column = 0; column < columns; column++)
      {
        Console.WriteLine("chessboard[" + row + ", " + column + "] = " +
          chessboard[row, column]);
      }
    }

  }

}


           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Collections Data Structure
» Array Dimension