declaring a two dimensional vector in c++ code example Example: 2d vector c++ declaration vector< vector<int>> a(rows, vector<int> (cols));