How to assign size to a globally declared 2d vector in the main function in C++?

  2d-vector, assign, c++, stl, vector
#include <bits/stdc++.h>
using namespace std;
vector< vector<int> >Adj;
int main()
{
    int n;
    cin>>n;
    Adj.assign(n);
}

This code doesn’t work for assigning size to the vector.

Source: Windows Questions C++

LEAVE A COMMENT