1130.  What is the procedure needed to remove a record from a list?

 

  1. Get the address of the record to deleted (assume we store it in pointer newdata)
  2. Rearrange the pointers:

q           If the record to be deleted is the first record on the list, make the next record in the list the first record

q           If the record to be deleted is the last record, make the record that points to it the last record (I,e., change its next field to NULL)

q           Otherwise have the record that points to the record to be deleted point to the record that the record to be deleted points to

 

3.   Free the address of the record to be deleted:

 

      free(newdata);