Skip to content
Permalink
683a3dc15a
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
44 lines (31 sloc) 942 Bytes
#ifndef __QUEUE_H
#define __QUEUE_H
#include <stdlib.h>
typedef struct QueueNode {
int data;
struct QueueNode* next;
} QueueNode;
typedef struct Queue {
size_t size;
QueueNode* head;
QueueNode* tail;
} Queue;
/* Create a brand new queue out of thin air. */
Queue* create_queue();
/* Take a peek at what's at the front of the queue. */
int front(Queue* queue);
/* Take a peek at what's at the back of the queue. */
int back(Queue* queue);
/* Enqueue an integer to the front of the queue. */
void enqueue(Queue* queue, int data);
/* Dequeue an integer from the queue. */
int dequeue(Queue* queue);
/* Send the queue into non-existance. */
void destroy_queue(Queue* queue);
/* Print out all of the elements of the queue. */
void print_queue(Queue* queue);
/* Determine how many elements are in the queue. */
size_t size(Queue* queue);
/* Determine if the queue is empty like my soul. */
int is_empty(Queue* queue);
#endif