Am i right in thinking the only way to create a list which grows during run time in C, is to use a linked list?
A dynamic list combines the power and flexibility that a fragment would have with contribution capabilities. The dynamic list performs a query in the content server, displays the files that match that query, and allows contributors to modify those files, even add new ones.
Why not use the std::vector or std::list class instead of writing your own? Both are dynamically-growing lists.
Linked lists are the best and simplest example of a dynamic data structure that uses pointers for its implementation.
You could use a combination of malloc and realloc. To first initialize a C array (malloc) and to grow it (realloc). However, you won't want to grow it by 1 element at a time if you are doing a lot of inserts. It's best to come up with a scheme to make the list grow as you need it (ie add 10 elements each time the list size reaches the allocated size).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With