int main() { vector<int> arr = {1,2,4,5,6,7,8}; ListNode* data = CreateList(arr); PrintList(data); ListNode* ret = swapPairs(data); PrintList(ret); DestoryList(ret); }
int main(int argc, char *argv[]) { LinkList *p = NULL; InitList(&p); DestoryList(&p); //ClearList(&p); return 0; }
int main () { int (*CallBackFunction[2])(int number) = { add, sub }; CreatSingleList(10); function(header,CallBackFunction[0]); DestoryList(header); return 0; }
//////////////////////////////////////// //此表带一个无数据的头////////////////// int main(void) { List P; int input; ElementType temp; /////////////////////////////////////////// P = IniList(); while( scanf("%d", &input) ) { temp.number = input; Insert(P, temp, Length( P )); printf("insert\n"); } /////////////初始化及插入测试段//////////// /////////////////////////////////////////// printf("Locate:\n"); input = 4; temp.number = input; printf("%d位于:%d\n", input, Locate( P, temp )); /////////////locate测试段////////////////// /////////////////////////////////////////// printf("get:\n"); input = 6; temp = Get( P, input ); //取出6位置的数据域,插入到链表末尾 Insert(P, temp, Length( P )); PR( P ); //////get测试段//////////////////////////// /////////////////////////////////////////// Delete( P, 1); //删除头中尾 printf("\n"); PR( P ); // Delete( P, 4); printf("\n"); PR( P ); Delete( P, 9); /////Delete测试段////////////////////////// printf("\n"); PR( P ); DestoryList( P ); return 0; }