aboutsummaryrefslogtreecommitdiff
path: root/main.c
blob: 0c0b28231b03a0b844bc95f0cef43632b4cd5b6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <stdio.h>
#include <stdlib.h>
#include "vector.h"

int main(void){
    vector_t vec = vector_init(16);

    printf("The size of the vector is %d.\n", size(vec));
    printf("The capacity of the vector is %d.\n", capacity(vec));
    printf("is_empty returns: %d.\n", is_empty(vec));


    printf("-----\n");

    for (int i = 0; i < vec.max_size; i++){
        if (i%2 == 0){
            push(&vec, 5);
            continue;
        }
        push(&vec, i);
    }
    print_vec(vec);
    remove_val(&vec, 5);
    /* for (int i = 0; i < vec.max_size; i++){ */
        /* printf("pop: %d\n", pop(&vec)); */
        /* delete_vec(&vec, 0); */
    /* } */

    printf("The size of the vector is %d.\n", size(vec));
    printf("The first element of the vector is %d.\n", at(vec, 0));
    printf("is_empty returns: %d.\n", is_empty(vec));
    print_vec(vec);

    destroy_vec(&vec);
    return 0;
}