-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvector.h
44 lines (30 loc) · 861 Bytes
/
vector.h
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
37
38
39
40
41
42
43
44
#ifndef VECTOR_H
#define VECTOR_H
// vector of void * pointers
struct vector{
int size;
int capacity;
void **values;
};
// vector of ints
struct intvector{
int size;
int capacity;
int *values;
};
struct vector * init_vector();
void resize_vector(struct vector * v, int capacity);
void add_vector(struct vector *v, void *p);
// returns thing that was removed
void * remove_vector(struct vector *v);
void free_vector(struct vector *v);
// returns thing that was removed
void * delete_vector(struct vector *v, int index);
struct intvector * init_intvector();
void resize_intvector(struct intvector * v, int capacity);
void add_intvector(struct intvector *v, int x);
// returns thing that was removed
int remove_intvector(struct intvector *v);
// returns thing that was removed
int delete_intvector(struct intvector *v, int index);
#endif