Why am I getting segmentation fault in this piece of code?
#include<bits/stdc++.h>
using namespace std;
int main()
{
vector<vector<string> > v;
v[0].push_back("good");
cout<<v[0][0];
}
I am trying to insert the string "good" in the first vector, and I am trying to access that by v[0][0]
, but it is giving me segmentation fault
. Please help. Thanks.