C program reversed linked list

前端 未结 2 1481
迷失自我
迷失自我 2021-01-28 08:46

Im trying to write a program in c that adds big numbers with linked list. I used reverse to add the numbers, but i cant get it to reverse again. It should be used several times(

2条回答
  •  不思量自难忘°
    2021-01-28 09:47

    As the question is not very specific with the issue you're are facing, below are some points to be taken care,

    In function reverse(),

    return reversed, reversedTail; will always return reversedTail.

    You are trying to call this function from main() as

    root, head = reverseLinkedList(sum, headSum); which again head will get the return values. This is incorrect. Usually you should be using a assignment to one member at a time.

提交回复
热议问题