libhl/source/vector.h

35 lines
834 B
C
Raw Normal View History

2023-08-23 21:14:12 -04:00
#ifndef VECTOR_H
#define VECTOR_H
2023-08-23 19:29:23 -04:00
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// TODO: Handle error warnings?
// TODO: Implement more useful functions?
typedef struct {
char * data;
size_t element_size;
size_t element_count;
} vector_t;
extern void vector_init(vector_t * vector,
size_t element_size,
size_t element_count);
extern void vector_push(vector_t * vector,
void * data);
extern void vector_pop(vector_t * vector);
2023-08-23 21:14:12 -04:00
extern void * vector_get(const vector_t * const vector,
const size_t element);
2023-08-23 19:29:23 -04:00
extern void vector_set(vector_t * vector,
void * data,
size_t element);
extern void vector_free(vector_t * vector);
2023-08-23 21:14:12 -04:00
#endif