我正在尝试将两个二维数组(大小相同;8 x 4)传递给一个函数,并将一个数组设置为另一个数组(某些元素的顺序不同,但这并不重要)。到目前为止,我有:
int main() {
double** Array1;
double** Array1;
// MALLOC BOTH OF THEM
....
// PUT STUFF IN ARRAY1
....
CopyFunction(&Array1, &Array2);
}
void CopyFunction(double*** Array1, double*** Array2) {
for (int i = 0; i < 8; i++) {
*Array2[i][0] = *Array1[i][0];
*Array2[i][1] = *Array1[i][1];
*Array2[i][2] = *Array1[i][2];
*Array2[i][3] = *Array1[i][3];
}
}
但我收到这样的段错误错误:
*** Break *** segmentation violation
===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================