The middle section of the program on linked lists in books is not very clear.

  c++, question

The program is a part quantity database, which is the code of insert

void insert (void){
 struct part *cut, *prev, *new_node;
 
 new_node = malloc(sizeof(struct part));
 if (new_node == NULL){
 printf("Database is full\n");
 return;
 }
 
 printf("Enter part number:");
 scanf("%d",&new_node->number);
 
 for(cur = inventory, prev = NULL;
 cur !  = NULL && new_node->number > cur->number;
 prev = cur, cur = cur->next);
 
 if(cur !  = NULL && new_node->number == cur->numebr){
 printf("part already exist\n");
 free(new_node);
 return;
 }
 printf("Enter part name:");
 Read _ line (new _ node-> name, name _ len)//reads the name
 printf("Enter quantity on hand:");
 scanf("%d",&new_node->on_hand);
 
 new_node->next = cur;
 if(prev == NULL)
 inventory = new_node;
 else
 prev->next=new_node;
 }

This paragraph is not very understood

for(cur = inventory, prev = NULL;
 cur !  = NULL && new_node->number > cur->number;
 prev = cur, cur = cur->next);
 
 if(cur !  = NULL && new_node->number == cur->numebr){
 printf("part already exist\n");
 free(new_node);
 return;
 }

This paragraph was directly skipped during the first time (the first data entry) and was not understood very well after the second time.cur ! = NULL && new_node->number > cur->number;What is the function of this part?

In order to ensure that the linked list is orderly. Stop the loop when the new number is less than or equal to the current number, and insert a new node before it, because the current number is greater than the previous item (if any). This ensures that the linked lists are arranged from small to large.