Hi I'm fairly new to vectors in C++ and I'm having some problems with them. I have a vector of vectors but I don't know why it is causing a segment fault in my program?
vector < vector<int> > grades;
int temp;
for(int i = 0; i < 30; i++)
{
for(int j = 0; j < 20; j++)
{
myGrades>>temp;
grades[i].push_back(temp);
}
}
What can I do to get this to work? It compiles fine but then crashes when I try to run it... I've debugged it down to these lines of code. Please help!