-1
我宣称H
从TwoDimArray
函数为2D动态数组。当线(标记为**
)执行时,编译器显示误差:
Access violation writing location 0x61d1e5bc.
访问冲突写入位置0x61d1e5bc
小海伦& LENB值(如250),没有任何问题!
int lenA=100030;
int lenB=100030;
int **H;
int TwoDimArray(int ***x,int nRow,int nCol)
{
int i;
*x=(int **)malloc(nRow*sizeof(int *));
if(*x==NULL)
return 1;
(*x)[0]=(int *)malloc(nCol*nRow*sizeof(int));
if((*x)[0]==NULL)
return 2;
for(i=1;i<nRow;i++)
(*x)[i]=(*x)[i-1]+nCol;
return 0;
}
TwoDimArray(&H, lenB, lenA);
for(int j=0;j<lenA;j++){
H[0][j]=0;
}
** for(int i=0;i<lenB;i++){
H[i][0]=0;
}
**编译器**显示错误? – trojanfoe 2013-05-06 18:49:47
'H'在哪里?给我们看一看。 – 2013-05-06 18:50:28
这不是C++ – yngccc 2013-05-06 18:51:14