Skip to content

Latest commit

 

History

History
76 lines (56 loc) · 1.21 KB

README.md

File metadata and controls

76 lines (56 loc) · 1.21 KB

Generic queue

A simple C implementation of a generic queue data structure. Provides all the basics methods of a queue. It can be used as a static library

Supported Operations

  • enqueue
  • dequeue
  • front
  • reverse
  • getSize
  • clearQueue

Basic Usage

include "queue.h"
/*.........*/
typedef struct Foo {
	int a;
}Foo;

Foo f;
f.a =100;
queue* q = createQueue(sizeof(Foo));
enqueue(q, &f);

Foo temp;
dequeue(q, &temp);

destroyQueue(&q);
/*..........*/

See main.c for a complete example.

Bulding

Linux

Run Example

cmake -S . -B build/
cd build;
make example
./example

You can also run make genericQueue to build just the library

Unit Tests

Also have created some basic unit tests using gtest and C++.
Test are compiled automatically but you must run them.

cmake -S . -B build/
cd build;
make all # This also compiles and executes the unit tests
ctest

Windows

cmake -S . -B build/
cd build;
cmake --build .
ctest # To run the tests

In the Debug/ folder the example is located together with the static library.

You can also open the solution file with visual studio.