Maha

Maha

  • NA
  • 0
  • 309.3k

NP67 Dimensional Array

Dec 1 2007 7:36 AM

Hi Guys

 

NP67   Dimensional Array

 

By means of counting the elements (below program) it is possible to predict number of elements in one-dimensional array prior to the execution of the program. And elements can be assigned as follows:

 

empID[0] = 15

empID[1] = 20

empID[2] = 5

 

In the three dimensional array though Length is 4 (below program) how can predict number of elements in. And how can elements be assigned. Anyone knows please explain.

 

Thank you

 

using System;

 

class MainClass

{

    public static void Main()

    {

        int[] empID = new int[] { 15, 20, 5, };

 

        int[, ,] empArray = new int[1, 2, 2];

       

        Console.WriteLine("empID.Length = " + empID.Length);

        Console.WriteLine("empArray.Length = " + empArray.Length);

    }

}

/*

empID.Length = 3

empArray.Length = 4

*/

 


Answers (5)