C declarations for Project 2 (Dynamic Memory)

Here's the struct declarations for the Queues and Linked lists for Project 2. You can download the declarations given below, or copy and paste them.

#define MAX_LINE      25

/* Typedef defines an alias for a type.                             */

/* Defines EventNode to be the same as a struct event_node          */
typedef struct event_node EventNode;

struct event_node
{
  char type;                  /*  'A'rrival or 'D'eparture Event    */
  int time;                   /*  Time of the Event                 */
  int items;                  /*  For Arrival, # items in cart      */
  int line;                   /*  For Departure, Line customer in   */
  EventNode *next;            /*  Next node                         */
};

/* Defines EventList to be the same as a struct llist               */
typedef struct llist EventList;

struct llist
{
  EventNode *head;            /*  Head pointer of event list        */
  int num_nodes;              /*  Number of events in list          */
};

/* Defines QueueNode to be the same as a struct queue_node          */
typedef struct queue_node QueueNode;

struct queue_node 
{
  int numitems;               /*  Number of items in cart           */
  int arrivetime;             /*  Time of customer's arrival        */
};

/* Defines CheckoutLine to be the same as a struct checkout_queue   */
typedef struct checkout_queue CheckoutLine;

struct checkout_queue 
{
  QueueNode queue[MAX_LINE];  /*  The array to store queue in       */
  int front;                  /*  Front of queue                    */
  int back;                   /*  Back of queue                     */
  int num;                    /*  Number items in queue             */
};
Return to David's Math 210 Home Page.
Return to David's Home Page.
Return to Cayuga's Home Page.

Valid HTML 3.2!