If you write int m[1000000];
inside the main function of C/C++, it will get a runtime error for stack overflow. Instead if you write vector<int> m;
and then push_back 1000000 elements there, it will run fine.
I am very curious about why this is happening. They both are local memory, aren't they? Thanks in advance.