-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patharray.h
More file actions
35 lines (27 loc) · 771 Bytes
/
array.h
File metadata and controls
35 lines (27 loc) · 771 Bytes
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
#ifndef ARRAY_H
#define ARRAY_h
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct array
{
size_t size;
size_t capacity;
void **data;
} array_t;
array_t *create_array(size_t capacity);
array_t *clone(array_t *array);
int fatal(char *msg);
int add(array_t *array, void *element);
int contains(array_t *array, void *element);
int is_empty(array_t *array);
void *get_at(array_t *array, unsigned int index);
void *get_first(array_t *array);
void *get_last(array_t *array);
void clear(array_t *array);
void delete(array_t *array, unsigned int index);
void free_array(array_t *array);
void set(array_t *array, unsigned int index, void *element);
void print_array(array_t *array, unsigned int type);
size_t size(array_t *array);
#endif