delete.c
来自「一个有关linux下面Makefile与链表结合的演示程序」· C语言 代码 · 共 29 行
C
29 行
#include<stdio.h>
#include"def.h"
struct student * del(struct student * head, long num)
{
struct student *p1,*p2;
if(head==NULL)
{printf("\nList null!\n");goto end;}
p1=head;
while((num!=p1->num)&&(p1->next!=NULL))
{
p2=p1;
p1=p1->next;
}
if(num==p1->num)
{
if(p1==head)
head=p1->next;
else
p2->next=p1->next;
printf("\nthe value %ld was deleted!\n",num);
n=n-1;
}
else
printf("\nThe value %ld is not found!\n",num);
end:
return (head);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?