+ 1

I don't know why i can't use append function. Func cause programme to crashed as getting to it in for loop.

https://code.sololearn.com/cSi3jzEo1CBS/?ref=app

6th Mar 2018, 5:17 AM
Amin Karimian
Amin Karimian - avatar
2 Antworten
+ 1
I solve it my self, the only problem is from traverse function. where we check if ((cursor->next! = NULL)) (cause run time error) but i can't find any reason for this!!! https://code.sololearn.com/cZi0Eecr3qxw/?ref=app
8th Mar 2018, 9:14 AM
Amin Karimian
Amin Karimian - avatar
- 1
Your append() function intends to insert a new node before Head. It successfully patches the next pointer that used to point to Head, to point to the new element, but it doesn't write tge new element's next pointer to the original Head. You should add: newNode->next = Head; Before line 58 Also change || to && on line 48: while(cursor->next != NULL && cursor->next != Head){
7th Mar 2018, 6:12 PM
Udi Finkelstein
Udi Finkelstein - avatar