int main(){ struct dl_node* my_d_list = NULL; add_at_end(&my_d_list, 90); add_at_end(&my_d_list, 10); add_at_end(&my_d_list, 20); add_at_end(&my_d_list, 30); add_at_end(&my_d_list, 40); add_at_end(&my_d_list, 50); add_at_end(&my_d_list, 100); add_at_end(&my_d_list, 80); add_at_end(&my_d_list, 60); add_at_end(&my_d_list, 70); cout << "\nDisplaying list:\n"; diplay_d_list(my_d_list); cout << "\nSorting the d_list\n"; }
int main(void) { /* One structure used in the program */ struct node llist; int rc,i; printf("\nAdding at the start of the list..."); rc = add_at_start(&llist,53); if(rc) { printf("\nAdding at the start of the list not successful..."); exit(0); } printf("\nAdding at the start of the list successful..."); printf("\nDisplaying the list..."); rc = display_ll(&llist); printf("\nAdding at the end..."); rc = add_at_end(&llist,103); printf("\nDisplaying the list..."); rc = display_ll(&llist); printf("\nModifying the start of the list..."); rc = modify_at_start(&llist,43); printf("\nDisplaying the list..."); rc = display_ll(&llist); printf("\nModifying the end of the list..."); rc = modify_at_end(&llist,203); for(i=0;i<5;i++) { rc = add_at_end(&llist,(i+99)); } printf("\nDisplaying the list..."); rc = display_ll(&llist); for(i=0;i<3;i++) { rc = add_at_end(&llist,(i+150)); } printf("\nDisplaying the list..."); rc = display_ll(&llist); printf("\nInserting after node 3..."); rc = add_after(&llist,3,504); printf("\nDisplaying the list..."); rc = display_ll(&llist); printf("\nModifying node 4..."); rc = modify_node(&llist,4,555); printf("\nDisplaying the list..."); rc = display_ll(&llist); printf("\nDeleting Node 5..."); rc = delete_node(&llist,5); printf("\nDisplaying the list..."); rc = display_ll(&llist); for(i=0;i<3;i++) { rc = add_at_end(&llist,(i+342)); } printf("\nDisplaying the list..."); rc = display_ll(&llist); printf("\nInserting after node 1..."); rc = add_after(&llist,1,35); printf("\nDisplaying the list..."); rc = display_ll(&llist); printf("\n\n"); return 0; }