В следующем коде я получаю segfault в последней строке:
int MAX_ITER = 4, n = 5;
vector< pair<int, vector<int> > > InputVector(MAX_ITER);
srand((unsigned)time(NULL));
for (int i = 0; i < MAX_ITER; i++)
InputVector[i].second.resize(n);
for (int i = 0; i < MAX_ITER; i++) {
InputVector[i].first = i+1;
for (int j = 0; j < InputVector[i].second.size(); i++)
InputVector[i].second[j] = rand()%2;
Как получить доступ к j- InputVector[i].second
элементу InputVector[i].second
?
for (int j = 0; j < InputVector[i].second.size(); i++)
^^ should be j++