本文介绍了错误:索引超出了数组的范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正面临这个问题索引超出了数组的界限.
即使我增加了数组的大小,这个问题仍然存在.

Iam facing this problem Index outside the bounds of array.
Even if i increase the size of array, this problem still persist.

public partial class corelation_test : Form
   {
       public corelation_test()
       {
           InitializeComponent();
       }
       int[] x_prev = new int[2000000];
       int[] y_prev = new int[2000000];

       public corelation_test(int [] x,int [] y)
       {
           InitializeComponent();

           x.CopyTo(x_prev,0);
           y.CopyTo(y_prev,0);

       }
              int count = 0;
              double[] min_x = new double[20000000];
              double[] min_y = new double[20000000];
                int k = 0;
               double [] min = new double [20000000];
do
 {
  for (double i = (x_prev[count] - 10.5); i<(x_prev[count] + 10.5); i++)
  {
  for (double j = (y_prev[count] - 10.5); j<(y_prev[count] + 10.5); j++)
  {
  min[k]=Math.Pow (((x_prev [count]+11)-(x_prev [count ]+i+21))+((y_prev [count ]+11)-(y_prev [count ]+j+21)),2);
k++;
   }
   }

Error is in array min[k].
While project gets build it stops at line :
  min[k]=Math.Pow (((x_prev [count]+11)-(x_prev [count ]+i+21))+((y_prev [count ]+11)-(y_prev [count ]+j+21)),2);

推荐答案




这篇关于错误:索引超出了数组的范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 10:22