/*
 * queue.h
 * This code is used as an example in the heap lecture
 * Note that there are still somethings missing from this file
 * like header guards, but it works.
 */

#include <stdbool.h>

// Queue is a queue that stores integers that is
// implmented with a singly linked list
// a user can create a queue, add integers to the end,
// remove integers from the front, clear the queue,
// and print all values in it.

typedef struct queue_node_st {
  int val;
  struct queue_node_st *next;
} Queue_Node;

typedef struct queue_st {
  Queue_Node *first, *last;
} Queue;

// Normally it is good practice to have comments
// in here to explain the behaviour of each function
Queue* Queue_Allocate();

void Queue_Add(Queue *q, int val);

bool Queue_Remove(Queue *q);

void Queue_Clear(Queue *q);

void Queue_Print(Queue *q);

void Queue_Free(Queue *q);
