Step 7


Your linked list is awesome! Now delete it.

  1. Uncomment the inclusion of "destroylist.h" at the top of lab12.c.

  2. At the end of lab12.c, call the function defined in destroylist.h with the appropriate parameters. Where's destroylist.c, you say? It's hidden so you can write a DestroyList() function that will free the memory allocated for each node in your linked list in your Project 5.

  3. Recompile your code, and this time, link it with destroylist.o.

...and that's the end of 201 Lab!


linux1[1]% gcc -Wall -ansi -c lab12.c linux1[2]% gcc lab12.o linkedlist.o destroylist.o linux1[3]% a.out data.txt Welcome to the last lab of the semester! :) First Name Last Name ID Grade -------------------- -------------------- ------------ ------- Ann Lewis 123 98% Joseph Eisenhower 212 82% Mary Jones 634 85% Mark Johnson 345 78% Justin Lewis 122 99% Jenny Garcia 121 87% Gary Watson 532 92% Jamie Casselman 621 100% Samantha Warrez 124 86% Bob Ramsey 141 64% Claire Dishon 161 76% Number of students in the class: 11 Average grade: 86.09% Please enter the id# to delete from the list: 621 Student was successfully deleted from class list. First Name Last Name ID Grade -------------------- -------------------- ------------ ------- Ann Lewis 123 98% Joseph Eisenhower 212 82% Mary Jones 634 85% Mark Johnson 345 78% Justin Lewis 122 99% Jenny Garcia 121 87% Gary Watson 532 92% Samantha Warrez 124 86% Bob Ramsey 141 64% Claire Dishon 161 76% Number of students in the class: 10 Average grade: 84.70% Successfully destroyed the list!! You're done!