【正文】
(8分) 13 / 13。(10分) (2)設(shè)計一組測試用例,盡量使main 函數(shù)的語句覆蓋率能達到100% 。 return head。 p1 = (list_pointer) malloc(sizeof(list_node))。 p2link = p1。t)。 for(i = 0。 p1= p2= (list_pointer) malloc(sizeof(list_node))。 printf(please input the data for the link node:\n)。length)。 printf(please input the node number of the link:\n)。 list_pointer p1, p2, head。 } choose)。 } printf(please input your choice\n)。 default:break。 print(ptr)。 case 3: printf(you will invert the link\n)。 print(ptr)。 } node = traillink。 while(i trail = traillink。 trail = ptr。 node = ptr。 scanf(%d, amp。 case 2: printf(you will delete a node from the link\n)。 /* p為指向ptr的指針 */ print(ptr)。 i++。 i = 1。location)。 printf(please input the location of the node:\n)。choose)。 printf(please input your choice\n)。 printf(input number 2, you can delete a node from the link\n)。 //根據(jù)用戶的不同選擇進行相應(yīng)的操作: printf(input number 0, you can quit the program\n)。 //建立一個單向鏈表: ptr=create()。 int choose, location, i。 list_pointer *p = amp。int main() { list_pointer ptr=NULL。 //打印鏈表節(jié)點中的值 list_pointer invert(list_pointer lead)。 //在node后加入一個新的節(jié)點 void delete_node(list_pointer *p_ptr, list_pointer trail, li