#ifndef __LIST_DELETE_ALL__ #define __LIST_DELETE_ALL__ /** * list-delete-all.h * The new "list_delete_all" function. */ #include "list.h" /** * Procedure: * list_delete_all * Parameters: * lst, a pointer to a list * str, a string * Purpose: * Delete all copies of str from lst. * Produces: * ok, an integer * Preconditions: * lst is not NULL. * str is not NULL. * lst contains N copies of str. That is, there are N distinct i * s.t. list_get (list, i) is str. * Postconditions: * No elements have been added to lst. * No elements have been rearranged in lst. * If the procedure suceeded, ok is true and * lst contains no copies of str. That is, list_index_of (lst, str) * returns -1. * The length of lst has decreased by N. * No other elements have been rearranged or deleted or added. * If the procedure failed, ok is false and * Some copies of str may have been deleted. */ int list_delete_all (struct list *lst, char *str); #endif // __LIST_DELETE_ALL