13(i) Write a plan to create a running(a) coupled marrow interactively and printout the tendency and total amount of items in the list.PROGRAM# imply #include #define futile 0struct linked_list{int number;struct linked_list *next;}; eccentricdef struct linked_list client;main (){int n; guest * query = zilch; deprave print( pommel *p); knob *insert_Sort(node *p, int n);printf(Input the list of numbers.n);printf(At end, type -999.n);scanf(%d,&n);while(n !
= -999){if( calculate == NULL){head = (node *)malloc(sizeof(node));head ->number = n;head->next = NULL;}else{head = insert_sort(head,n);}scanf(%d, &n);}printf(n);print(head);print(n);}node *insert_sort(node *list, int x){node *p1, *p2, *p;p1 = NULL;p2 = list;for( ; p2->number < x ; p2 = p2->next){p1 = p2;if(p2->next == NULL){ sep2 = p2->next; scatter;}}p = (node *)malloc(sizeof(node)); /* space for tender node */p->number = x; /* enjoin value in the unexampled node */p->next = p2; /* link new-sprung(prenominal) node to key node */if (p1 == NULL)list = p;elsep1->next = p; publication (list);}void print(node *list){...If you want to recognize a full essay, decree it on our website: Ordercustompaper.com
If you want to get a full essay, wisit our page: write my paper
No comments:
Post a Comment