b(k)=a(i),此时i=10
Private Sub Form_Load()
Show
Dim a(9) As Integer, b(9) As Integer
For i = 0 To 9
a(i) = InputBox("请输入10个整数")
Print a(i);
Next i
Print
For i = 9 To 0 Step -1
k = 9 - i
b(k) = a(i)
Print b(k);
Next i
End Sub
b(k) = a(i)
i = 10
当然越界。
For i = 0 To 9
a(i) = InputBox("请输入10个整数")
k = 9 - i
Print a(i);
Next i
当循环结束时i的值是10,再运行下一句b(k)=a(i)时,就变成了a(10),数组下标越界。。。