This doesn''t work!, but is close
node* AppendNode(node** headRef, int num) { node* current = *headRef; node* prev_ptr = *headRef; node* newNode; newNode = (node*)malloc(sizeof(node)); newNode->value = num; newNode->next = NULL; // special case for length 0 if (current == NULL) { *headRef = newNode; } else { while (current->next != NULL && newNode->value > current->value) { prev_ptr = current; current = current->next; } prev_ptr->next = newNode; newNode->next = current; } return *headRef;}
||||-- Our creation is the transformation of one. --|||