How can I create a dynamically sized array of structs?

后端 未结 10 1204
春和景丽
春和景丽 2020-11-27 11:46

I know how to create an array of structs but with a predefined size. However is there a way to create a dynamic array of structs such that the array could get bigger?

<
10条回答
  •  孤城傲影
    2020-11-27 12:42

    Another option for you is a linked list. You'll need to analyze how your program will use the data structure, if you don't need random access it could be faster than reallocating.

提交回复
热议问题