Skip to content
Snippets Groups Projects
Select Git revision
  • 71e7f697e2faa5fff085be27522c839abe671638
  • master default protected
2 results

vectors.h

Blame
  • vectors.h 966 B
    /*
        Autheur		: Abivarman KANDIAH
        Date		: 22/02/2022
        Fichier		: vectors.h
        Descritpion : Vectors functions header
    */
    
    #ifndef _VECTORS_H_
    #define _VECTORS_H_
    
    #define VECTOR_INIT_CAPACITY 4
    
    #include <stdio.h>
    #include <stdlib.h>
    #include <stdint.h>
    #include <stdbool.h>
    #include <assert.h>
    
    typedef int type;
    typedef struct vector_* vector;
    
    vector vector_create();
    int vector_length(vector vec);
    void vector_push(vector vec, type element);
    type vector_pop(vector vec);
    void vector_set(vector vec, int index, type element);
    type vector_get(vector vec, int index);
    type vector_remove(vector vec, int index);
    void vector_insert(vector vec, type element, int index);
    void vector_empty(vector vec);
    void vector_free(vector vec);
    void vector_print(vector vec, void (*print)(type));
    vector vector_map(vector vec, type (*f)(type));
    vector vector_filter(vector vec, bool (*f)(type));
    type vector_reduce(vector vec, type neutral, type (*f)(type, type));
    
    #endif