1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#ifndef VECTOR_H
#define VECTOR_H

#include <stddef.h>

struct Vector
{
    double * const data;
    const size_t dim;
};

// Constructor
struct Vector VectorConstruct(size_t dim);

// Destructor
void VectorDestruct(struct Vector *vec);

// Pointer to element (with bounds check)
double *VectorElementPtr(struct Vector *vec, size_t index);

// Value of element (with bounds check)
double VectorElement(const struct Vector *vec, size_t index);

#endif // VECTOR_H