using vector in c++ to construct 2d array code example Example: initializing 2d vector vector<vector<int> > vec( n , vector<int> (m, 0));