DSA Hacking Club Library
Loading...
Searching...
No Matches
queue.h
Go to the documentation of this file.
1
10
11#ifndef QUEUE_H
12#define QUEUE_H
13
14#include <stdbool.h>
15
19#define QUEUE_EMPTY (-1)
20
26typedef struct node {
27 int value;
28 struct node *next;
30
36typedef struct {
39} queue;
40
48void init_queue(queue *q);
49
58bool enqueue(queue *q, int value);
59
66int dequeue(queue *q);
67
75void printqueue(queue *q);
76
77#endif // QUEUE_H
struct node node_t
A node in the singly linked list.
bool enqueue(queue *q, int value)
Insert a new value at the end of the queue.
Definition queue.c:11
int dequeue(queue *q)
Remove and return the value at the front of the queue.
Definition queue.c:26
struct node node_t
Node structure for the queue.
void printqueue(queue *q)
Print the contents of the queue to stdout.
Definition queue.c:38
void init_queue(queue *q)
Initialize a queue.
Definition queue.c:6
A node in the singly linked list.
Definition linkedlist.h:22
struct node * next
Pointer to the next node in the list.
Definition linkedlist.h:24
int value
The integer value stored in the node.
Definition linkedlist.h:23
Queue structure.
Definition queue.h:36
node_t * head
Pointer to the first node in the queue.
Definition queue.h:37
node_t * tail
Pointer to the last node in the queue.
Definition queue.h:38