Well I am totally beginner.
I came across this program.
Module arrayredim
Sub main()
Dim marks() As Integer
ReDim marks(2)
marks(0) = 85
marks(1) = 75
marks(2) = 90
ReDim Preserve marks(10)
marks(3) = 80
marks(4) = 76
marks(5) = 92
marks(6) = 99
marks(7) = 79
marks(8) = 75
For i = 0 To 10
Console.WriteLine(i & vbTab & marks(i))
Next i
Console.ReadKey()
End Sub
End Module
In this program can somebody explain me why
ReDim Preserve marks(10) is important to be written here?
Also
ReDim marks(2) is important to be written in this way?
I tried cancelling these lines and run the program but it showed errors.