+ 2
Why does the program end when i try to delete a record thats not in the list [SOLVED]
Hey guys, So the delete part of this program runs pefectly with records that are in the list. When i try deleting a record thats not in the list, rather than printing an error message and going back to the menu, the program simply ends. Please advise me on what ive done wrong. Thanks https://code.sololearn.com/cpQ89d8obQ7e/?ref=app
6 ответов
+ 1
I cprrect your code case c so check it please. May be some errors since it was write by mobile
https://code.sololearn.com/cipM9dJAqMQ7/?ref=app
+ 2
Oooo i found the problem. The problem in do{}while(cur!=null).
If you check for example you have 2 elements you take start element not equal, then go do while, where you make prev =cur, cur=next check cur and cur not equal, then you make one more time prev=cur cur=nex but next is 0 in this case)))).
So make changes just instead of do while set while(curr!= null) do operatiin
+ 1
You can also unite starting check in intermediate check in one while do!!!!
It is example of linear list)
0
Could you please told me what you comment//uncomment
0
Thank you george
0
U r welcome!