.
..; 동 2 동 배 만는 방 ..; . 데 데..--;
vector 들 보 대 만들봤. 면 마-_- . 받 모 0 는
~cpp #include <iostream> #include <vector> using namespace std; vector< vector<int> > ar; // 백 ! 면 러. void Alloc(int nRow, int nCol); void SetArrayAsZero(int nRow, int nCol); void Show(int nRow, int nCol); int main() { int row, col; cout << " " ; cin >> row; cout << "\n : "; cin >> col; Alloc(row, col); return 0; } void Alloc(int nRow, int nCol) { ar.resize(nRow); for(int i = 0 ; i < nRow ; i++) ar[i].resize(nCol); }
방 , 내부는 1 배 는 방 . row*width+col 를 런 .
see also:
- Why Arrays are Evil
- A Class Template for N-Dimensional Generic Resizable Arrays
- Bjarne Stroustrup on Multidimensional Array 1, 2
- array보 vector를 먼 르는 대 " C++" 르는 를 받 는
AcceleratedCPlusPlus