I implemented a vector class in C for integers. Any feedback welcome.header:#define DEFAULT_CAPACITY 1000// Define a vector typetypedef struct {  int nrOfElements;     // Current number of elements.  int capacity; // Possible capacity.    int *data;    // Pointer to array elements.    } CVectorInt;typedef enum {VECTOR_SUCCESS, VECTOR_OUTOFBOUNDS, VECTOR_MEMORYERROR} vector_error;vector_error CVectorInit(CVectorInt *vector);vector_error CVectorAppend(CVectorInt *vector, int value);vector_error CVectorGet(CVectorInt *vector, int index, int * value);vector_error CVectorSet(CVectorInt *vector, int index, int value);void CVectorFree(CVectorInt *vector);.c:#include CVectorInt.h#include <stdio.h>#include <stdlib.h>vector_error CVectorInit(CVectorInt *vector){    int i = 0;    vector->capacity = DEFAULT_CAPACITY;    vector->nrOfElements = 0;    vector->data = malloc(sizeof(int) * vector->capacity);    if(vector->data == NULL)        return VECTOR_MEMORYERROR;    // Initialization in C never hurts.    for(i = 0; i<DEFAULT_CAPACITY; i++)        vector->data[i] = 0;    return VECTOR_SUCCESS;}vector_error CVectorAppend(CVectorInt *vector, int value) {    int * ptr = NULL;    int i = 0;    // Resize vector if there is no space for more elements.    if(vector->capacity == vector->nrOfElements)    {        vector->capacity *= 2;        ptr = realloc(vector->data, vector->capacity * sizeof(int));        if(ptr == NULL)                  {                   return VECTOR_MEMORYERROR;        }        else        {            vector->data = ptr;             // Initialize new elements to 0.            for(i = vector->nrOfElements; i<vector->capacity; i++)                vector->data[i] = 0;        }    }    vector->data[vector->nrOfElements++] = value;    return VECTOR_SUCCESS;}vector_error CVectorGet(CVectorInt *vector, int index, int * value){    if(index < vector->nrOfElements && index >= 0)    {        // Pass value at given index.        *value = vector->data[index];        return VECTOR_SUCCESS;    }else    {        return VECTOR_OUTOFBOUNDS;    }}vector_error CVectorSet(CVectorInt *vector, int index, int value){    if(index >= vector->capacity)        return VECTOR_OUTOFBOUNDS;    vector->data[index] = value;    return VECTOR_SUCCESS;}void CVectorFree(CVectorInt *vector){  free(vector->data);}Usage:#include <stdio.h>#include <stdlib.h>#include CVectorInt.hint main(void) {    //error handling omitted for simplicity    CVectorInt v;    int i = 0, temp = 0;    CVectorInit(&v);    for(i = 0; i<100; i++)    {        CVectorAppend(&v, i*2);    }    for(i = 0; i<100; i++)    {        CVectorGet(&v, i, &temp);        printf(%d , temp);    }    CVectorFree(&v);    return 0;}
Dynamic array of integers
c