Skip to content

A tested, thread safe, mutable, iterable, integer indexed collection

License

Notifications You must be signed in to change notification settings

Jacob-C-Smith/array

Repository files navigation

array

CMake

Dependencies:
sync

A minimal array implementation written in C.

1 Download

2 Build

3 Example

3.1 Example output

4 Tester

5 Definitions

5.1 Type definitions

5.2 Function definitions

Download

To download array, execute the following command

$ git clone https://github.com/Jacob-C-Smith/array

Build

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)

Example

To run the example program, execute this command

$ ./array_example

Example output

TODO

Source

Tester

To run the tester program, execute this command after building

$ ./array_test

Source

Tester output

Definitions

Type definitions

typedef struct array_s array;

Function definitions

// 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 );

About

A tested, thread safe, mutable, iterable, integer indexed collection

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published