Monday, July 27, 2009

Array

The following code declares an array that can store 100 items starting from index 0 to 99.
int [] intArray;

intArray = new int[100];
int[,] numbers = new int[3, 2] { {1, 2}, {3, 4}, {5, 6} };

string[,] names = new string[2, 2] { {"A","B"}, {"X","Y"} };
int[] numArray = {1, 3, 5, 7, 9, 11, 13};

foreach (int num in numArray)

{

System.Console.WriteLine(num.ToString());

}

No comments:

Post a Comment