how to declare a 2d vector in cpp code example Example: 2d vector c++ declaration vector< vector<int>> a(rows, vector<int> (cols));