- 双链表测试:test.c:
cs
#include"List.h"
void ListTest01()
{
//LTNode* plist = NULL;
//LTInit(&plist);
LTNode* plist = LTInit();
LTPushBack(plist, 1);
LTPushBack(plist, 2);
LTPushBack(plist, 3);
LTPrint(plist);
LTNode* find = LTFind(plist, 3);
//LTInsert(find, 66);
LTErase(find);
find = NULL;
LTPrint(plist);
LTDesTroy(plist);
//plist = NULL;
//if (find == NULL)
//{
// printf("找不到!\n");
//}
//else {
// printf("找到了!\n");
//}
//LTPushFront(plist, 1);
//LTPrint(plist);
//LTPushFront(plist, 2);
//LTPrint(plist);
//LTPushFront(plist, 3);
//
//
测试尾删
//LTPopBack(plist);
//LTPrint(plist);
//LTPopBack(plist);
//LTPrint(plist);
//LTPopBack(plist);
//LTPrint(plist);
测试头删
//LTPopFront(plist);
//LTPrint(plist);
//LTPopFront(plist);
//LTPrint(plist);
//LTPopFront(plist);
//LTPrint(plist);
//LTPopBack(plist);
//LTPrint(plist);
}
int main()
{
ListTest01();
return 0;
}
结合前面的两章内容,才是一个完整的双链表的创建和实现。