Create a sorted linked list
问题 After almost 3 years, I've started relearning C . I've created a Linked list , and would like to extend this to creating a sorted linked list. Here is my code: typedef struct node{ int data; struct node *ptr; }node; node* insert(node* head, int num){ node *temp,*prev,*next; temp = (node*)malloc(sizeof(node)); temp->data = num; temp->ptr = '\0'; if(head=='\0'){ head=temp; }else{ next = head; prev = next; while(next->data<=num){ prev = next; next = next->ptr; } if(next==NULL){ prev->ptr = temp;