Why does the following happen?
Output:Code:vector<int> toReturn(void); vector<int> toReturn(void){ return {2, 4, 6, 8, 10}; } int main(int argc, char *argv[]){ vector<int>::iterator iter = toReturn().begin(); for(; iter != toReturn().end(); ++iter){ cout << *iter << " "; } cout << endl; }
The first two values of the output change with each run of the program. I am using Eclipse and the MinGW gcc compiler with the c++11 flag.Code:6098688 6105968 6 8 10