![]() |
Survival Royale 1.0.0
A very simple yet funny card game.
|
Implementation of vector structure and related functions. More...
#include "vector.h"
Go to the source code of this file.
Functions | |
vector * | buildVector () |
Builds a vector structure initializing its fields. If vector's allocation or data's block allocation fails, it exits with EXIT_ALLOC_FAILED exit code. | |
void | freeVector (vector *const vector) |
Frees the memory used from the vector structure. | |
void | resize (vector *const vector, const size_t newCapacity) |
Resizes the capacity of the vector with the new capacity specified. If vector's data's block allocation fails, it exits with EXIT_ALLOC_FAILED exit code. | |
void | pushBack (vector *const vector, const data_type element) |
Pushes an element at the back of the vector. | |
data_type | popBack (vector *const vector) |
Pops the element at the back of the vector. If necessary, the vector is resized automatically. If the vector is empty, it exits with EXIT_POP_FAILURE exit code. | |
void | pushFront (vector *const vector, const data_type element) |
Pushes an element at the front of the vector. If necessary, the vector is resized automatically. | |
data_type | popFront (vector *const vector) |
Pops the element at the back of the vector. If necessary, the vector is resized automatically. If the vector is empty, it exits with EXIT_POP_FAILURE exit code. | |
data_type | at (vector *vector, size_t index) |
Access at the element in the given index of the vector. If the index is greater or equal to the vector's size, it exits with EXIT_ILLEGAL_INDEX_FAILURE exit code. |
Implementation of vector structure and related functions.
Definition in file vector.c.
Access at the element in the given index of the vector. If the index is greater or equal to the vector's size, it exits with EXIT_ILLEGAL_INDEX_FAILURE exit code.
vector | The vector. |
index | The index to access to. |
vector * buildVector | ( | ) |
void freeVector | ( | vector *const | vector | ) |
Pops the element at the back of the vector. If necessary, the vector is resized automatically. If the vector is empty, it exits with EXIT_POP_FAILURE exit code.
vector | The vector from which the element is poped. |
Pops the element at the back of the vector. If necessary, the vector is resized automatically. If the vector is empty, it exits with EXIT_POP_FAILURE exit code.
vector | The vector from which the element is poped. |
void resize | ( | vector *const | vector, |
const size_t | newCapacity ) |