Home > Software engineering >  I use the head method to set up a singly linked list, write a delete function, but don't know h
I use the head method to set up a singly linked list, write a delete function, but don't know h

Time:11-23

Int dellist (linklist L, int I)
{
Pre Node * and * r;
int k;
The pre=L; k=0;
While (pre!=NULL& & K{
The pre=pre - & gt; Next;
k=k+1;
}
If (pre - & gt; Next==NULL)
{
Printf (" fail!" );
Return the ERROR;
}
R=pre - & gt; Next;
The pre - & gt; Next=r - & gt; Next;
Free (r);
return OK;
}

CodePudding user response:

Initialization is to write, is called the tune in the main initialization and delete

CodePudding user response:

Entrance to the main () function defined variables, create a linked list, and then add elements, look for the element, remove elements ~
  • Related