}
/*打印单链表*/
void Print(LinkList *L) {
if (*L == null)
return;
Node *p = *L;
for (; p; p = p->next) {
printf("%d ", p->data);
}
printf("\n");
}
/*递归逆序打印单链表*/
void FromTailPrint(LinkList *L) {
if (*L == null)
return;
FromTailPrint(&(*L)->next);
printf("%d ", (*L)->data);
}
int main() {
LinkList L;
InitList(&L);
TailCreate(&L);
fflush(stdin);
printf("打印单链表\n");
Print(&L);
printf("单链表结点的个数是:%d\n", TotalNum(&L));
printf("删除9\n");
Remove(&L, 9);
printf("打印单链表\n");
Print(&L);
printf("追加10\n");
AddToTail(&L, 10);
printf("逆序打印单链表\n");
FromTailPrint(&L);
system("pause");
return 0;
}
不带头结点的单链表(2)
内容版权声明:除非注明,否则皆为本站原创文章。
转载注明出处:https://www.heiqu.com/3051a3160b3047c1b11cf78062402101.html