int main() { struct node_top *sll = create_sll(); ___sl_plot(NULL); return 0; }
int main() { // create a SLL struct item *dll = create_sll(); ___sl_plot("01-sll-ready"); // convert the SLL to DLL by completing the 'prev' field sll_to_dll(dll); ___sl_plot("02-dll-got-from-sll"); // convert the DLL to SLL by zeroing the 'next' field dll = dll_to_sll(dll); ___sl_plot("03-sll-got-from-dll"); // finally just destroy the list to silence our garbage collector while (dll) { struct item *prev = dll->prev; free(dll); dll = prev; } ___sl_plot("04-done"); return 0; }
struct item* create_slseg(void) { struct item *list = create_sll(); struct item *sls = list->next; free(list); return sls; }
int main() { const struct node *p1, *p2; struct node *list = create_sll(&p1, &p2); __VERIFIER_plot(NULL, &list, &p1, &p2); check_seq_next(p1, p2); __VERIFIER_assert(!p1->prev); __VERIFIER_assert(!p2->prev); init_back_link(list); __VERIFIER_plot(NULL, &list, &p1, &p2); check_seq_next(p1, p2); check_seq_prev(p2, p1); reverse_dll(list); __VERIFIER_plot(NULL, &list, &p1, &p2); check_seq_prev(p1, p2); check_seq_next(p2, p1); remove_fw_link(list); __VERIFIER_plot(NULL, &list, &p1, &p2); check_seq_prev(p1, p2); while (list) { struct node *prev = list->prev; free(list); list = prev; } return 0; }
int main() { struct item *sll = create_sll(); __VERIFIER_plot(NULL); (void) sll; return 0; }
int main() { struct item *sll = create_sll(); ___sl_plot(NULL); if (!destroy_by_any(sll->next)) // we have only head --> destroy the head free(sll); return 0; }
int main() { sll *head = NULL; int input_arr[] = {12,2,45,3,4,6,7}; int i; for(i=0;i<7;i++) { create_sll(&head,input_arr[i]); } printf("\n"); print_all_nodes(head); printf("\n"); reverse_list(&head,&(head->next)); printf("\n"); print_all_nodes(head); printf("\n"); }
int main() { node_t head; node_t *ph = &head; int nd = 3; head.v = 5; create_sll(&ph); print_sll(&ph); ph = reverse_sll(&ph); print_sll(&ph); del_sll(&ph, nd); print_sll(&ph); ph = reverse_sll(&ph); print_sll(&ph); return 0; }