debug assertion failed! Can't fix the problem

My question matches the title, also any insight how to fix problems like this in the future on my own would be great.
The code below is the function(odigravanje_poteza) which makes my program stop working, function called within it seems to run ok. I added main, and the other function used just to give perspective.
Thanks.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
int redosljed_igranja(int n)
{
	return (n%2)+1;
}

vector<vector<int> > odigravanje_poteza(vector<vector<int> > matrix, int n)
{
	int potez;
	cin >> potez;
	if(potez==1 || potez==2 || potez==3)
		matrix[3][potez]=redosljed_igranja(n);
	if(potez==4 || potez==5 || potez==6)
		matrix[2][potez]=redosljed_igranja(n);
	if(potez==7 || potez==8 || potez==9)
		matrix[1][potez]=redosljed_igranja(n);
	return matrix;
}
	int main()
{
	vector<vector<int> > tbl(3,vector<int>(3,0));
	int br=0;
	
	ispisi_trenutno_stanje(tbl);

    do
	{
		ispisi_redosljed_igranja(br);
		tbl=odigravanje_poteza(tbl,br);
		ispisi_trenutno_stanje(tbl);
		//provjera pobjednika
		br++;
	}while(br<=9); 


	
}
1
2
vector<vector<int> > tbl(  3  ,vector<int>(3,0));
matrix[  3  ]  //indices are beginning with 0, so vector with size of 3 will have 0, 1 and 2 as valid indices 
Oh my! thanks a lot. Lack of sleep must've got to me... :)
Topic archived. No new replies allowed.