Bug In Vectors

Revision en1, by ofi, 2017-11-15 01:13:04
vector<int> v;

int f()
{
	v.push_back(-1);
	return 1;
}
int main()
{
	v.push_back(0);
	cout<<v[0]<<endl;
	v[0]=f();
	cout<<v[0]<<' '<<v[1]<<endl;
		
	return 0;
}

expected output:

0

1 -1

output:

0

0 1

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English ofi 2017-11-15 01:13:04 263 Initial revision (published)