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)

Recommended Answers

All 3 Replies

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

thanks alot for all of you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.