Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

I have a linked list - problem with load a saved list

+2 votes
asked Dec 20, 2018 by okire (250 points)
I have a linked list, "append" is no problem, "display" is no problem, "save" is no problem, but there is the problem when I try to "load" a "saved" list and then "display" it

https://onlinegdb.com/BysupNdgN

1 Answer

0 votes
answered Dec 20, 2018 by SS
Few suggestions:

1. In Load() function you're doing malloc for variable tem twice, which is wrong.

2. Always validate malloc return value.

Coming to load issue, you got to read file line by line till you reach EOF, temp = temp->link inside of while() in Load() function is wrong. So, check your logic,
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...