private void SampleJaggedArray()
{
int[][] jaggedArray;
jaggedArray = new int[2][];
jaggedArray[0] = new int[3];
jaggedArray[1] = new int[6];
jaggedArray[0][0] = 1; jaggedArray[0][1] = 2; jaggedArray[0][2] = 3;
jaggedArray[1][0] = 1; jaggedArray[1][1] = 2; jaggedArray[1][2] = 3;
jaggedArray[1][3] = 4; jaggedArray[1][4] = 5; jaggedArray[1][5] = 6;
for (int i = 0; i < jaggedArray.GetLength(0); i++)
{
Console.Write("jaggedArray[" + i + "] :\t");
for (int j = 0; j < jaggedArray[i].Length; j++)
{
Console.Write(jaggedArray[i][j] + "\t");
}
Console.WriteLine();
}
}
Monday, May 12, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment