Btw, for anyone interested, here's what I get with the undefined code:

Inserting
5
10
-33686019
0
459177
Printing
458760

What I find curious is this:

cout<<v[0]<<endl<<v[1]<<endl<<v[2]<<endl<<v[3]<<endl<<v[4]<<endl;
cout<<"Printing"<<endl;
cout<<v[4]<<endl;//v[4] has a value and its being printed which means [] operator has inserted it

It prints the same element twice, yet got different results.
And I suggest that anyone who thinks it is NOT undefined code, takes a look inside the ACTUAL code for vector.

I took a look at the code and it looks like this:

Code:
	reference operator[](size_type _Pos)
		{	// subscript mutable sequence

 #if _HAS_ITERATOR_DEBUGGING
		if (size() <= _Pos)
			{
			_DEBUG_ERROR("vector subscript out of range");
			_SCL_SECURE_OUT_OF_RANGE;
			}
 #endif /* _HAS_ITERATOR_DEBUGGING */
		_SCL_SECURE_VALIDATE_RANGE(_Pos < size());

		return (*(_Myfirst + _Pos));
		}
_Myfirst is a pointer of type int*. Does that insert a value?
If it does, then I don't see how.
Blam! Rumor smashed. Operator [] does not insert.