C ++ returns an invalid value in the following code:
#include <iostream> #include <vector> using namespace std; int f(){ vector< int * > v[2]; return 1; v[1].push_back(NULL); } int main(){ cout << f(); }
Conclusion:
205960
When I return the commnet line after the return, it works fine:
#include <iostream> #include <vector> using namespace std; int f(){ vector< int * > v[2]; return 1; //v[1].push_back(NULL); } int main(){ cout << f(); }
Conclusion:
1
I am using code :: blocks with mingw32-g ++. exe compiler. Mingw version: gcc version 4.4.1 (TDM-2 mingw32).
codez source share