Big array gives segmentation error in C

前端 未结 4 2063
情话喂你
情话喂你 2020-12-04 02:48

I am really new to C, so I am sorry if this is a absolute beginner question, but I am getting a segmentation error when I am building large array, relevant bits of what I am

4条回答
  •  暖寄归人
    2020-12-04 03:43

    You're consuming too much stack. The limit is platform dependent.

    The exact limit depends on the OS. These limits can be changed to some extent on some operating systems .

    For large amounts of memory, you should be using the head with malloc and/or calloc (and free).

提交回复
热议问题