What is the error in my code?
Code not working
https://ide.codingblocks.com/s/600394 i have corrected ur code… its working fine now… there was error in ur reverse list function only…
i am unable to understand how ur code is correct and mine is not, it’s seems to work just same
try to dry run on paper… u would get ur mistake… both are nowhere same…
bro ek pointer idhar ka udhar hua to pura code gya
bro initially next pointer null rhega… then as loop runs assign it no the next… and correspondingly do…
node *prev = NULL;
node *curr = head;
node *next = NULL;
while(curr != NULL){
next = curr->next;
curr->next = prev;
prev = curr;
curr =next;
}
return prev;
I hope ur doubt is cleared now???
got it, thanks for ur help
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.