GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - BaseMax/QueueC: This is a simple queue implementation in C using an array. The queue is implemented as a normal queue.

BranchesTags
Open more actions menu

Latest commit

 

History

9 Commits
9 Commits

Folders and files

NameName
Last commit message
Last commit date
.vscode
.vscode
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
Queue.c
Queue.c
 
 
Queue.h
Queue.h
 
 
README.md
README.md
 
 
example.c
example.c
 
 

Repository files navigation

Queue C

This is a simple queue implementation in C using an array. The queue is implemented as a normal queue.

Functions

  • Queue* createQueue(int size): Create a queue with a given size.
  • void destroyQueue(Queue* queue): Destroy the queue object.
  • bool isEmpty(Queue* queue): Check if the queue is empty
  • bool isFull(Queue* queue): Check if the queue is full
  • void enqueue(Queue* queue, int element): Enqueue an element to the queue
  • int dequeue(Queue* queue): Dequeue an element from the queue
  • int getFront(Queue* queue): Get the front element of the queue.
  • int getRear(Queue* queue): Get the rear element of the queue.
  • int getSize(Queue* queue): Get the size of the queue

Usage

// Create a queue
Queue* queue = createQueue(5);

// Enqueue elements
enqueue(queue, 1);
enqueue(queue, 2);
enqueue(queue, 3);
enqueue(queue, 4);
enqueue(queue, 5);

// Check if the queue is full
if (isFull(queue)) {
    printf("Queue is full!\n");
} else {
    printf("Queue is not full!\n");
}

// Dequeue elements
printf("Dequeue: %d\n", dequeue(queue));
printf("Dequeue: %d\n", dequeue(queue));
printf("Dequeue: %d\n", dequeue(queue));

// Get the front element
printf("Front: %d\n", getFront(queue));

// Get the rear element
printf("Rear: %d\n", getRear(queue));

// Get the size of the queue
printf("Size: %d\n", getSize(queue));

// Destroy the queue
destroyQueue(queue);

License

This project is licensed under the GPL-3.0 License - see the LICENSE file for details.

© Copyright Max Base, 2022

About

This is a simple queue implementation in C using an array. The queue is implemented as a normal queue.

Topics

cdata-structuredata-structures-algorithmsdata-structures-and-algorithmsdatastructuredatastructuresqueuequeue-algorithmqueue-jobsqueue-tasksqueues

Resources

Readme
GPL-3.0 license
Activity

Stars

2 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.