-1

hello every one i'm a new member in this web site i'm really happy coz i found the best web to
leran the computer language it is will be better if some one explean for me the array in c# and syntax of using
array , i hope some one do it
thanks alot (DANA)

3
Contributors
3
Replies
15
Views
4 Years
Discussion Span
Last Post by dana2292
0

An array is something that can hold a lot values , For instance you can store one value in a variable

int a=5;
string z="bob";
char b='b';

but in a array you can store a lot of values , for instance

int [] array1=new int [3];
array1[0]=3;
array1[1]=2;
array1[2]=5;

the syntax of an array goes like this

type_of_variable [] array_name=new type_of_variable [number of elements in array];

the new keyword is here to initialize the array and you must use it.
the sign [] means that the array is one dimensional
for example if you would have this sign [,] it would be two dimensional and so on...
i suggest you to go to this site for more information
One other thing ,, array1[0] the [0] is the first array address it just means that you are storing a value the first element in the first element of the array which always has a value of 0 . The last element in the array will always have (array_size-1) address
http://www.dotnetperls.com/array
Good luck

Edited by castajiz_2: none

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.