【发布时间】:2015-11-23 21:27:41
【问题描述】:
举例说明我遇到的问题。我做了这个简单的程序,我试图阅读一堆教程并在谷歌搜索我的问题,但我就是不明白。
#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;
}
【问题讨论】:
-
尝试谷歌搜索“动态二维数组 C++”,或者看看这个问题:stackoverflow.com/questions/936687/…