我知道动态分配内存的两种方法。我了解“新”是如何工作的,但我不明白“静态演员”是如何工作的:
double* A1;
double** A2;
//1D array
A_1 = new double[size];
A_1 = static_cast <double*> (new double[c]);
//2D array
A_2 = reinterpret_cast <double**> (new double[r]);
for(i = 0; i < r; i++)
A_2[i] = static_cast <double*> (new double[c]);
我不明白 static 和 reinterpret 是如何工作的。