Permalink
Cannot retrieve contributors at this time
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?
queue/queue.h
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
44 lines (31 sloc)
942 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |