4.1.3 Deletion

Deleting a list also involves deleting the associated array, but only when the index is 0. This is because it is possible for a list to map to a non-zero index. The deletion of a non-zero index list is simply to change the size of the array to the index minus one.

struct List List_delete(struct List *pList)
{
  if (index == 0)
  {
    ArrayADT_delete(((struct _List *)pList)->array);
  }
  free(pList);
}



Copyright © 2006-09-27 by Tak Auyeung