我正在用 C++ 编写,但是我得到了关于
的错误declaration of 'triangle' as multidimensional array must have bounds for all dimensions except the first
我有一个类似于下面的函数:
int func( int height, int row, int check, int triangle[][]) {
// some code
}
我下面有一段代码是这样的:
int main(){
int small, big;
if( func( height, x, 0, triangle)>big){
small = big;
big = func( height, x, 0, triangle);
}
}
谁能告诉我我做错了什么?
最佳答案
你可以这样使用...
template <typename TwoD>
int func(int height,int row, int check, TwoD& triangle){
}
TwoD 适用于所有二维数组类型的数据结构,示例
vector<vector<T>>
或用户定义的类型以最大化代码重用。
关于c++ - 错误 : too many arguements to function,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33195741/