Распечатать упорядоченный связанный список

Просто сделал некоторые изменения, я попробовал то, что вы сказали, но это не сработало, поэтому я попробовал кое-что, с чем я немного знаком, но, похоже, он не работает правильно. Он печатает информацию странным образом, затем вылетает. Например: когда я ввожу 9-8-7-6-5-4-3-2-1, а затем 0 для печати, он печатает мне обратно 0-0-0-9- 1-2-3-4-5-6-7-8 а потом вылетает? когда я ввожу 1-2-3-4-5-6-7-8-9, затем 0, чтобы напечатать, он возвращает мне 0-0-0-1-2-3-4-5-6-7- 8-9, а затем вылетает.

#include 
#include 

struct listNode{
  int data;    //ordered field
  struct listNode *next;
};

//prototypes
void insertNode(struct listNode *Head, int x);
int printList(struct listNode *Head);
int freeList(struct listNode *Head, int x);

//main
int main(){
     struct listNode Head = {0, NULL};
     int x = 1;
     int ret = 0;
     printf("This program will create an odered linked list of numbers greater"
     " than 0 until the user inputs 0 or a negative number.\n");
     while (x > 0){
           printf("Please input a value to store into the list.\n");
           scanf("%d", &x);
           insertNode(&Head, x);
     }
     ret = printList(&Head);
     }
void insertNode(struct listNode * Head, int x){
     struct listNode *newNode, *current;
     newNode = malloc(sizeof(struct listNode));
     newNode->data = x;
     newNode->next = NULL;
     current = Head;
     while (current->next != NULL && current->data < x) 
     {
        current = current->next;
        }

        if(current->next == NULL){
             current->next = newNode;
        }
        else{
             newNode->next = current->next;
             current->next = newNode;
        }
}
int printList(struct listNode * Head){
    struct listNode *current = Head;
    while (Head != NULL){
          printf("%d \n", *current);
          current = current->next;
    }
}

Ответы на вопрос(2)

Ваш ответ на вопрос