Can you give an example of stack overflow in C++?

后端 未结 12 1519
不知归路
不知归路 2020-12-31 18:52

Can you give an example of stack overflow in C++? Other than the recursive case:

void foo() { foo(); }
12条回答
  •  礼貌的吻别
    2020-12-31 19:47

    The typical case that does not involve infinite recursion is declaring an automatic variable on the stack that is too large. For example:

    int foo()
    {
        int array[1000000];
    
    }
    

提交回复
热议问题