-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharray.h
executable file
·34 lines (22 loc) · 883 Bytes
/
array.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
/**
*@file string.h
* A simple dynamic string array for storing strings
using struct for a compact datatype and remove the tripple star programming
This sd_array is tracks the size and capactiy for easy access.
* @author Dennis Addo
* @date 24/07/2017
**/
#ifndef ARRAY_H
#define ARRAY_H
#include <stdio.h>
typedef struct sd_array {
size_t capacity; //holds the total size of the array
size_t size; //holds the current number of elements in the array
char **mem; //where elements are stored
}sds_array;
extern sds_array init_sds_array(size_t size);
extern void add_str(sds_array *sdsa,const char *s);
extern int search_indx(size_t *ind, const sds_array *sda, const char *path);
extern void delete_str(sds_array *array, const size_t index);
extern void freeall(sds_array *sds,size_t len);
#endif //ARRAY_H