C++ Difference between global and non-global arrays (Stackoverflow Exception) [duplicate]
问题 This question already has an answer here : Why does a large local array crash my program, but a global one doesn't? [duplicate] (1 answer) Closed 2 years ago . When I write the following program, it works correctly i.e. the bitset array is declared outside the main() method. Correctly Works #include <iostream> #include <bitset> using namespace std; bitset<5000> set[5000]; int main(){ cout<<"program runs fine"<<endl; return 0; } But I get stack-overflow exception when I create it inside the