A minimal array implementation written in C.
1 Download
2 Build
3 Example
3.1 Example output
4 Tester
5.1 Type definitions
To download array, execute the following command
$ git clone https://github.com/Jacob-C-Smith/array
To build on UNIX like machines, execute the following commands in the same directory
$ cd array
$ cmake .
$ make
This will build the example program, the tester program, and dynamic / shared libraries
To build array for Windows machines, open the base directory in Visual Studio, and build your desired target(s)
To run the example program, execute this command
$ ./array_example
TODO
To run the tester program, execute this command after building
$ ./array_test
typedef struct array_s array;
// Allocators
int array_create ( array **const pp_array );
// Constructors
int array_construct ( array **const pp_array, size_t size );
int array_from_elements ( array **const pp_array, void *const *const elements );
int array_from_arguments ( array **const pp_array, size_t size, size_t element_count, ... )
// Accessors
int array_index ( const array *const p_array, signed index, void **const pp_value );
int array_get ( const array *const p_array, const void ** const pp_elements, size_t *const p_count );
int array_slice ( const array *const p_array, const void ** const pp_elements, signed lower_bound, signed upper_bound );
bool array_is_empty ( const array *const p_array );
size_t array_size ( const array *const p_array );
// Mutators
int array_add ( array *const p_array, void *const p_element );
int array_clear ( array *const p_array );
int array_free_clear ( array *const p_array, void (*const free_fun_ptr)(void *) );
// Iterators
int array_foreach_i ( const array *const p_array, void (*const function)(void *const value, size_t index) );
// Destructors
int array_destroy ( array **const pp_array );