C# Programming - Arrays - Discussion

Discussion Forum : Arrays - General Questions (Q.No. 3)
3.
Which one of the following statements is correct?
Array elements can be of integer type only.
The rank of an Array is the total number of elements it can contain.
The length of an Array is the number of dimensions in the Array.
The default value of numeric array elements is zero.
The Array elements are guaranteed to be sorted.
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
4 comments Page 1 of 1.

Veerabhushan Konthanoor said:   5 years ago
Explain the answer in detail.

Hussain said:   1 decade ago
Whenever a object is created if the object has instance variables then they are initialized to default values.

The default value for string is null and for integer is 0, so..on..

Gloops said:   1 decade ago
Well when declaring intMyArr = new int[1,2].
I obtain intMyArr[1, 1] = 0.

But @Shweta, how do you verify the default value of the index ?
In the execution window, try :

? intMyArr[,]
or
? intMyArr[,0]

Syntax error ...

Shweta said:   1 decade ago
Arrays index start to zero and that's why arrays default value is zero.

Post your comments here:

Your comments will be displayed after verification.