CAR *removing(int *numberofstructures,CAR *first)
{
char categorytoerase[51];
CAR *helpnode,*actual;
int i;
int number_1=0;
helpnode=(CAR*)malloc(sizeof(CAR));
actual=(CAR*)malloc(sizeof(CAR));
actual=first;
number_1=*numberofstructures;
helpnode=NULL;
scanf("%s",categorytoerase);
for(i=1;i<=number_1;i++)
{
if (actual->znacka==categorytoerase)
{
if (helpnode != NULL) {
helpnode->next=actual->next;
free((void *)actual);
actual=helpnode->next;
}
else
{
first = actual -> next;
free((void *)actual);
actual = first;
}
}
else{
helpnode=actual;
actual=actual->next;
}
}
return first;
}
我想創建一個從鏈表中刪除節點的函數,首先你必須輸入字符串。它應該刪除那些有汽車類別名稱的節點,如輸入的字符串。鏈接列表清除節點
http://stackoverflow.com/questions/69209/deleting-a-middle-node-from-a-single-linked-list-when-pointer-to-the-previous-no,http:// stackoverflow .com/questions/13744946/delete-node-from-linked-list-recursively,http://stackoverflow.com/questions/13656061/delete-node-from-linked-list-with-specific-value –