4.1.2 Creation

Creating a list now requires the creation of an array ADT object, as well. It is, therefore, important to limit the initial capacity of an array ADT to save space.

struct List *List_new(void)
{
  struct _List *tmp;

  tmp = (struct _List *)malloc(sizeof(struct _List));
  tmp->array = ArrayADT_new(void);
  tmp->index = 0;
  return (struct List *)tmp;
}



Copyright © 2006-09-27 by Tak Auyeung