C Program crashing with large arrays

前端 未结 4 821
难免孤独
难免孤独 2021-01-17 08:15

I\'m trying to run a simulation that involves a large amount of calculations and values.

I\'ve got an issue in that large arrays cause the program to crash before it

4条回答
  •  长发绾君心
    2021-01-17 08:34

    adsorption is being allocated on the stack, and it must be overflowing the stack. Hence the error.

    Use malloc and family to allocate large chunks of data on the heap.

    edit

    Or make it static -- @Matt McNabb thanks! :-)

提交回复
热议问题