I have a question reguarding the use of a linked list of structures versus an array of structures. I would think that being able to use malloc and realloc as needed would be easier.
What am I missing? Where should each method be used?
Let us say using a linked list that you wanted to get some data from the user:
1. Create node.
2. Check the user supplied data.
3. Store data in node.
4. Goto 1.
Using an array to get data from user:
1. malloc or calloc some memory.
2. Check the user supplied data.
3. Store the data in the array.
4. If out of malloc’d memory, realloc.