#include <stdio.h>
#include <stdlib.h>

// https://aticleworld.com/implement-vector-in-c/

#define VECTOR_INIT_CAPACITY 7
#define UNDEFINE  -1
#define SUCCESS 0
//Store and track the stored data
typedef struct sVectorList
{
    void **items;
    int capacity;
    int total;
} sVectorList;
//structure contain the function pointer
typedef struct sVector vector;
struct sVector
{
    sVectorList vectorList;
//function pointers
    int (*pfVectorTotal)(vector *);
    int (*pfVectorResize)(vector *, int);
    int (*pfVectorAdd)(vector *, void *);
    int (*pfVectorSet)(vector *, int, void *);
    void *(*pfVectorGet)(vector *, int);
    int (*pfVectorDelete)(vector *, int);
    int (*pfVectorFree)(vector *);
    void (*pfVectorCopy)(vector *,vector *);
    
};
void vector_init(vector *v);
int vectorFree(vector *v);
int vectorDelete(vector *v, int index);
void *vectorGet(vector *v, int index);
int vectorSet(vector *v, int index, void *item);
int vectorPushBack(vector *v, void *item);
int vectorResize(vector *v, int capacity);
int vectorTotal(vector *v);
void vectorCopy(vector* v_to_copy, vector* v_from_copy);