Skip to content
Snippets Groups Projects
Commit 294dad27 authored by Boris Stefanovic's avatar Boris Stefanovic
Browse files

ADD: int vector type definition

parent 1704fb52
Branches
No related tags found
No related merge requests found
//
// Created by Boris Stefanovic on 24/05/22.
//
#include "vector.h"
#include <stdlib.h>
vector_int_t* vector_int_create(const size_t dim, const int* data) {
vector_int_t* v;
if ((v = malloc(dim * sizeof(int))) == NULL) return NULL;
v->dim = dim;
for (int i = 0; i < dim; ++i) v->data[i] = data[i];
return v;
}
//
// Created by Boris Stefanovic on 24/05/22.
//
#ifndef PROG_KMEANS_VECTOR_H
#define PROG_KMEANS_VECTOR_H
#include <stdlib.h>
typedef struct _vector_int {
size_t dim;
int* data;
} vector_int_t;
vector_int_t* vector_int_create(const size_t dim, const int* data);
#endif //PROG_KMEANS_VECTOR_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment