Maximum Stack Size for C/C+ Program?

后端 未结 4 1901
轻奢々
轻奢々 2020-12-01 12:42

I\'ve tried the below program. The intent by which this program was created is to discover more about stack sizes.

int main()
{
    int nStack[100000000];
           


        
4条回答
  •  鱼传尺愫
    2020-12-01 12:47

    I tried below program.

    int main()
    {
        int nStack[519492];
        cout<<"Okay!";
        return 0;
    }
    

    The output:

    Okay!
    

    But if I increase the array size by 1 byte, the program crashes.

    int main()
    {
        int nStack[519493];
        cout<<"Okay!";
        return 0;
    }
    

    Output:

    No output. Program crashes.
    

提交回复
热议问题