Write DIM statement to declare an array that could store average marks for ten students
Answers
Answered by
0
An array variable must be declared just like other variables, but it is not necessary to specify the number of elements. That said, you can declare an array and populate it with data at the same time. The following code declares an array of type String with seven elements, and then populates it:
Dim strWeekDays(6) As String
strWeekDays(0) = "Monday"
strWeekDays(1) = "Tuesday"
strWeekDays(2) = "Wednesday"
strWeekDays(3) = "Thursday"
strWeekDays(4) = "Friday"
strWeekDays(5) = "Saturday"
strWeekDays(6) = "Sunday"
The following statement declares and populates the array at the same time (note that this time there is no number within the parentheses) :
Dim strWeekDays() As String = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"}
You can also declare an array without specifying the number of elements it will hold:
Dim strMembers() As String
Dim strWeekDays(6) As String
strWeekDays(0) = "Monday"
strWeekDays(1) = "Tuesday"
strWeekDays(2) = "Wednesday"
strWeekDays(3) = "Thursday"
strWeekDays(4) = "Friday"
strWeekDays(5) = "Saturday"
strWeekDays(6) = "Sunday"
The following statement declares and populates the array at the same time (note that this time there is no number within the parentheses) :
Dim strWeekDays() As String = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"}
You can also declare an array without specifying the number of elements it will hold:
Dim strMembers() As String
sabitribiswal:
average narks for ten students
Similar questions
Hindi,
6 months ago
English,
6 months ago
Social Sciences,
6 months ago
Social Sciences,
1 year ago
English,
1 year ago