举例说明我遇到的问题。我做了这个简单的程序,我试着阅读一堆教程并在谷歌搜索我的麻烦,但我只是不明白。
#include<iostream>
using namespace std;
void noobFunction( int col , int table[][col]){ // compile error
table[0][0] = 2;
cout << table[0][0];
}
int main() {
cout << "Enter the number of rows in the 2D array: ";
int row;
cin >> row;
cout << "Enter the number of columns in the 2D array: ";
int col;
cin >> col;
int table[lin][col];
noobFunction(col, table);
return 0;
}