int main(int argc, char *argv[]) { unsigned int item_count = 10; list_t *list = NULL; list = init_list(item_count); print_list(list); revert_list(list); // return 0; }
void SList::unit_test_case() { srand(time(NULL)); const int kMaxNum = 10; const int kMaxValue = 199; node_pt phead = NULL, pcur = NULL; for (int iter = 0; iter != kMaxNum; iter++) { node_pt pnode = new node_t; pnode->data = rand() % kMaxValue; pnode->next = NULL; if (iter == 0) { phead = pnode; pcur = phead; } else { pcur->next = pnode; pcur = pnode; } } printf("before reverse: \n"); print_list(phead); revert_list(phead); printf("after reverse: \n"); print_list(phead); printf("reverse print: \n"); recur_revert_print(phead); destroy_list(phead); }