+ 4
In 'Allocate' function you're allocating the size of the pointer not the structure. It should be (Node*)malloc(sizeof(Node)).
31st Jan 2022, 7:38 AM
Tiba
Tiba - avatar
+ 1
I tried using 1 1 8 and it seems to work fine. Can you be more specific about the error and the input that you used to produce it?
31st Jan 2022, 5:14 AM
Ani Jona 🕊
Ani Jona 🕊 - avatar
0
Well spotted Tiba
31st Jan 2022, 7:55 AM
Ani Jona 🕊
Ani Jona 🕊 - avatar
0
The reason is, that the while loop in line 78 finishes one too early. You can fix that easily setting 'while(temp)' in line 78.
31st Jan 2022, 12:26 PM
Ani Jona 🕊
Ani Jona 🕊 - avatar