Declare large array on Stack

后端 未结 4 1061
我寻月下人不归
我寻月下人不归 2020-12-03 15:45

I am using Dev C++ to write a simulation program. For it, I need to declare a single dimensional array with the data type double. It contains 4200000

4条回答
  •  情话喂你
    2020-12-03 16:10

    You can increase your stack size. Try adding these options to your link flags:

    -Wl,--stack,36000000

    It might be too large though (I'm not sure if Windows places an upper limit on stack size.) In reality though, you shouldn't do that even if it works. Use dynamic memory allocation, as pointed out in the other answers.

    (Weird, writing an answer and hoping it won't get accepted... :-P)

提交回复
热议问题