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

后端 未结 12 1584
不知归路
不知归路 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:51

    Infinite recursion:

    void infiniteFunction()
    {
        infiniteFunction();
    }
    
    int main()
    {
        infiniteFunction();
        return 0;
    }
    

提交回复
热议问题