4.2.1 Creation

The creation of a queue involves the creation of a struct _Queue object and also a struct ArrayADT object:

struct Queue *Queue_new(void)
{
  struct _Queue *tmp;

  tmp = (struct _Queue *)malloc(sizeof(struct _Queue));
  tmp->array = ArrayADT_new();
  tmp->head = 0;
  tmp->size = 0;
  return (struct Queue *)tmp;
}



Copyright © 2006-10-23 by Tak Auyeung