I\'m trying to create a singly linked list from an input text file for an assignment. I\'m trying to do it a little bit at a time so I know my code is not complete. I trie
root
has an undefined value, so it won't initialize. The second line of CreateList
should be
LIST *root = NULL;
Also, further down there is allocation apparently for the details of the item, but a) the code fails to capture the allocation and save it anywhere, and b) the size of the allocation should be strSize
, not the length of the variable itself. There are several ways to fix it, but the most straightforward would be:
newList->str = (char *)malloc(strSize);
if (newList->str == NULL)