Monday, November 24, 2008

Arrays

An array is a data structure consisting of a group of elements that are accessed by indexing. In C# each element has the same data type and the array occupies a contiguous area of storage.

Declaring Arrays

Array are declared in the following wai in C#

[ ] ;

eg:

int[ ] myArray;
myArray[10]=5;

or we can define as this,

int[] myArray={1,2,3,5,7,3,5,7};

also we can
declared array as following two ways.

int[] myArray = new int[5] {5, 9, 10, 2, 99};

const int Size = 5;
int[] myArray = new int[Size] {5, 9, 10, 2, 99};


Here the one simple program that use String Array



You can see out put of above progarm in belove


No comments: