storing element position of a 2d vector

Hi, please help, I'm a beginner and need some help to store the value of a certain element position to a separate vector. here is the piece of function i've written so far. when i run it i get a print out of integers from 0 to whatever but not the element position.

void myfunction(vector<vector <char> > board)
{
vector<int> TempFile;

for(int i=0; i<board.size(); i++)
{
for(int j=0; j<board[i].size(); j++)
{
if(board[i][j]=='*')
{
cout<<i<<" "<<j<<endl;
TempFile.push_back(board[i].at(j));
}
}
}
for(int x=0; x<TempFile.size(); x++)
{
cout<<x<<endl;
}
}
I don't see any errors. May be the vector board you pass contains not what you expect?
It runs fine, but the values being pushed to TempFile is always, no matter the position of the '*', filled with values starting form 0,1,2,3.......
Ahhh, you print index 'x', not the value of TempFile[x]
Topic archived. No new replies allowed.