Allocating A Large (5000+) Array

后端 未结 3 927
一向
一向 2020-12-06 07:34

I am working on an application were there are three possible sizes for the data entered:

  • small: 1000 elements
  • medium= 5000 elements
  • large= 50
3条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-06 08:08

    It's too big for the stack. Instead you need to allocate it on the heap with malloc.

提交回复
热议问题