I wrote a function that should reverse a list.
So far, I can reverse only two items, but no more. I checked and double checked and still can\'t find the problem. I e
Sorry for answering late and I am sure that you would have found the answer by now but yet it might be helpful for others. Answer is simply taking return statement (i.e. return head;) out of while loop will fix your problem. Though there are ways you can avoid extra pointer and assignments to optimise your code.