如果我创建一个文件:
test.cpp:
然后运行: g++ test.cpp -o test
我得到:
test.cpp:
void f(double **a) {
}
int main() {
double var[4][2];
f(var);
}
然后运行: g++ test.cpp -o test
我得到:
test.cpp: In function `int main()':
test.cpp:8: error: cannot convert `double (*)[2]' to `double**' for argument `1'
to `void f(double**)'
为什么我不能这样做?
使用double var [4] [2] 不是等同于使用double **var 然后分配内存吗?