In the Spring of 2003, I was attending Carnegie Mellon and enrolled in an introductory C class. One of our homework assignments was to implement a linked list. Such an implementation had to include a function that took as an argument a pointer to the head node, freed all the memory associated with the linked list, and returned nothing.

Anyway, when we had done this assignment and turned it in, our TA sent us a message that included a code snippet:

void FreeThisSchnizzle(void* head)

{

free((void*) head);

FreeThisSchnizzle(head->next);

}

Evidently one of the students in the class had turned this in, and the TA responded accordingly. (I have to paraphrase here, as I don't have the original message)

"Guys, please test your code before you submit it to us. The function to free your linked list is worth 20% of your grade on this assignment, so don't mess it up!"

At any rate, the kid never resubmitted the code to the TA, so he was docked 20 of 100 points in the following manner: