I’m new to c++ and I was wondering why this part of my code was not working
void fill 2DVector (vector<int> someVec, int i)
{
for (auto& row: someVec)
row.fill(i) ;
}
>Solution :
There are several problems with the code.
First there should be an underscore or some other valid character between fill and 2DVector instead of a space.
Second, row is an int which is a built in type and doesn’t have member functions(like fill).
//-------v--------------------------------------->added underscore. You can add other valid character except space
void fill_2DVector (vector<int> someVec, int i)
{
for (auto& row: someVec)
cout << row; //you can print row which is an it
}